dicttool - Dictionary Tools
Contents
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 TcllibTrackers [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 unifieddiffs, 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.
Category
Utilities
Copyright
Copyright (c) 2017 Sean Woods <yoda@etoyoc.com>
tcllib 1.2 dicttool(3tcl)
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.
laddvarnameargs
This command will add a new instance of each element in args to varname, but only if that element
is not already present.
ldeletevarnameargs
This command will delete all instances of each element in args from varname.
dictgetnullargs
Operates like dictget, however if the key args does not exist, it returns an empty list instead
of throwing an error.
dictprintdict
This command will produce a string representation of dict, with each nested branch on a newline,
and indented with two spaces for every level.
dictis_dictvalue
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.
rmergeargs
Return a dict which is the product of a recursive merge of all of the arguments. Unlike dictmerge, 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.
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}
}
}
Keywords
dict
Name
dicttool - Dictionary Tools
Synopsis
package require Tcl8.59
package require dicttool?1.2?laddvarnameargsldeletevarnameargsdictgetnullargsdictprintdictdictis_dictvaluermergeargs
________________________________________________________________________________________________________________
