1dicttool(n)               Extensions to the standard               dicttool(n)
2
3
4
5______________________________________________________________________________
6

NAME

8       dicttool - Dictionary Tools
9

SYNOPSIS

11       package require Tcl  8.5
12
13       package require dicttool  ?1.0?
14
15       ladd varname args
16
17       ldelete varname args
18
19       dict getnull args
20
21       dict print dict
22
23       dict is_dict value
24
25       rmerge args
26
27______________________________________________________________________________
28

DESCRIPTION

30       The  dicttool  package  enhances the standard dict command with several
31       new commands. In addition, the package also defines  several  "creature
32       comfort"  list  commands as well.  Each command checks to see if a com‐
33       mand already exists of the same name before adding itself, just in case
34       any of these slip into the core.
35
36       ladd varname args
37              This  command will add a new instance of each element in args to
38              varname, but only if that element is not already present.
39
40       ldelete varname args
41              This command will delete all instances of each element  in  args
42              from varname.
43
44       dict getnull args
45              Operates  like dict get, however if the key args does not exist,
46              it returns an empty list instead of throwing an error.
47
48       dict print dict
49              This command will produce a string representation of dict,  with
50              each  nested  branch  on a newline, and indented with two spaces
51              for every level.
52
53       dict is_dict value
54              This command will return true if value can be interpreted  as  a
55              dict.  The command operates in such a way as to not force an ex‐
56              isting dict representation to shimmer into another internal rep.
57
58       rmerge args
59              Return a dict which is the product of a recursive merge  of  all
60              of  the arguments. Unlike dict merge, this command descends into
61              all of the levels of a dict. Dict keys which end in a : indicate
62              a  leaf,  which  will be interpreted as a literal value, and not
63              descended into further.
64
65
66
67              set items [dict merge {
68                option {color {default: green}}
69              } {
70                option {fruit {default: mango}}
71              } {
72                option {color {default: blue} fruit {widget: select values: {mango apple cherry grape}}}
73              }]
74              puts [dict print $items]
75
76
77              Prints the following result:
78
79
80              option {
81                color {
82                  default: blue
83                }
84                fruit {
85                  widget: select
86                  values: {mango apple cherry grape}
87                }
88              }
89
90

BUGS, IDEAS, FEEDBACK

92       This document, and the package it describes, will  undoubtedly  contain
93       bugs  and  other  problems.  Please report such in the category dict of
94       the  Tcllib  Trackers  [http://core.tcl.tk/tcllib/reportlist].   Please
95       also  report any ideas for enhancements you may have for either package
96       and/or documentation.
97
98       When proposing code changes, please provide unified diffs, i.e the out‐
99       put of diff -u.
100
101       Note  further  that  attachments  are  strongly  preferred over inlined
102       patches. Attachments can be made by going  to  the  Edit  form  of  the
103       ticket  immediately  after  its  creation, and then using the left-most
104       button in the secondary navigation bar.
105

KEYWORDS

107       dict
108

CATEGORY

110       Utilities
111
113       Copyright (c) 2017 Sean Woods <yoda@etoyoc.com>
114
115
116
117
118tcllib                                1.0                          dicttool(n)
Impressum