dicttool(n)

πŸ“¦
version 2.0 Β· 2 versions
, in fedora 43, fedora 44, nixos 26.05, nixpkgs unstable

✨ dicttool(n) β€” Dictionary Tools ✨

okay bestie, welcome to dicttool(n), aka Dictionary Tools, aka Extensions to the standard but make it dictionary-coded. it's a Tcl thing, and it's lowkey iconic. no cap. πŸ’…


πŸ’– NAME πŸ’–

  • dicttool β€” Dictionary Tools.

πŸ¦‹ SYNOPSIS πŸ¦‹

the vibe check, fr fr:

package require Tcl 8.5 9

package require dicttool ?1.2?

ladd varname args

ldelete varname args

dict getnull args

dict print dict

dict is_dict value

rmerge args

🌸 DESCRIPTION 🌸

The dicttool package enhances the standard dict command with several new commands. In addition, the package also defines several "creature comfort" list commands as well. Each command checks to see if a command already exists of the same name before adding itself, just in case any of these slip into the core. πŸ‘‘


πŸŽ€ ladd varname args πŸŽ€

This command will add a new instance of each element in args to varname, but only if that element is not already present. πŸ’–


πŸŽ€ ldelete varname args πŸŽ€

This command will delete all instances of each element in args from varname. 🧹✨


πŸŽ€ dict getnull args πŸŽ€

Operates like dict get, however if the key args does not exist, it returns an empty list instead of throwing an error. no dramatic meltdown, just vibes. 🫢


πŸŽ€ dict print dict πŸŽ€

This command will produce a string representation of dict, with each nested branch on a newline, and indented with two spaces for every level. it's giving organized. πŸ’…


πŸŽ€ dict is_dict value πŸŽ€

This command will return true if value can be interpreted as a dict. The command operates in such a way as to not force an existing dict representation to shimmer into another internal rep. ✨


πŸŽ€ rmerge args πŸŽ€

Return a dict which is the product of a recursive merge of all of the arguments. Unlike dict merge, this command descends into all of the levels of a dict. Dict keys which end in a : indicate a leaf, which will be interpreted as a literal value, and not descended into further. 🌈

example time, bestie:

set items [dict merge {
  option {color {default: green}}
} {
  option {fruit {default: mango}}
} {
  option {color {default: blue} fruit {widget: select values: {mango apple cherry grape}}}
}]
puts [dict print $items]

Prints the following result:

option {
  color {
    default: blue
  }
  fruit {
    widget: select
    values: {mango apple cherry grape}
  }
}

πŸ› BUGS, IDEAS, FEEDBACK πŸ’‘

This document, and the package it describes, will undoubtedly contain bugs and other problems. Please report such in the category dict of the Tcllib Trackers [http://core.tcl.tk/tcllib/reportlist]. Please also report any ideas for enhancements you may have for either package and/or documentation.

When proposing code changes, please provide unified diffs, i.e the output of diff -u.

Note further that attachments are strongly preferred over inlined patches. Attachments can be made by going to the Edit form of the ticket immediately after its creation, and then using the left-most button in the secondary navigation bar.


πŸ”‘ KEYWORDS πŸ”‘

dict


πŸ—‚οΈ CATEGORY πŸ—‚οΈ

Utilities


Copyright (c) 2017 Sean Woods <yoda@etoyoc.com>


okay that's the whole page, bestie. source/version: tcllib 1.2; page: dicttool(n). (no date in the footer, so we don't invent one.) slay. πŸ’–βœ¨

πŸ“¦ where this page comes from