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       ladd varname args
14
15       ldelete varname args
16
17       dict getnull args
18
19       dict print dict
20
21       dict is_dict value
22
23       rmerge args
24
25______________________________________________________________________________
26

DESCRIPTION

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

BUGS, IDEAS, FEEDBACK

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

KEYWORDS

106       dict
107

CATEGORY

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