site/contents/reference-dict.md
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 |
----- content-type: "page" title: "dict Module" ----- {@ _defs_.md || 0 @} {#op||dup||{{d1}}||{{d2}}|| Returns a copy of {{d1}}. #} {#op||del||{{d}} {{sl}}||{{d}}|| Removes {{sl}} from {{d1}} and returns {{d1}}. #} {#op||get||{{d}} {{sl}}||{{any}}|| Returns the value of key {{sl}} from dictionary {{d}}. #} {#op||get-raw||{{d}} {{sl}}||{{rawval}}|| Returns the value of key {{sl}} from dictionary {{d}}, wrapped in a {{rawval}}. #} {#op||has?||{{d}} {{sl}}||{{b}}|| > Returns {{t}} if dictionary {{d}} contains the key {{sl}}, {{f}} otherwise. > > > %sidebar% > > Example > > > > The following program returns {{t}}: > > > > {true :a1 "aaa" :a2 false :a3} 'a2 dict.has? #} {#op||keys||{{d}}||({{s}}{{0p}})|| Returns a quotation containing all the keys of dictionary {{d}}. #} {#op||pick||{{d1}} {{q}}||{{d2}}|| > Returns a new dictionary {{d2}} containing the elements of {{d1}} whose keys are included in {{q}}. > > > %sidebar% > > Example > > > > The following program returns `{4 :a 7 :d}`: > > > > {5 :q 4 :a 6 :c 7 :d "d" :a} ("a" "d") dict.pick #} {#op||pairs||{{d}}||({{a0p}})|| > Returns a quotation containing a quotation for each value/key pair (value first, key second) of dictionary {{d}}. > > > %sidebar% > > Example > > > > A The following program returns `((1 "a") (2 "b"))`: > > {1 :a 2 :b} dict.pairs #} {#op||set||{{d}} {{any}} {{sl}}||{{d}}|| Sets the value of the {{sl}} of {{d1}} to {{any}}, and returns the modified dictionary {{d}}. #} {#op||set-sym||{{d}} {{sl}} {{sl}}||{{d}}|| Sets the value of the {{sl}} of {{d1}} to {{sl}} (treating it as a symbol), and returns the modified dictionary {{d}}. #} {#op||type||{{d}}||{{s}}|| Returns a string set to the type of {{d}} (empty if the dictionary has no type). #} {#op||values||{{d}}||({{a0p}})|| Returns a quotation containing all the values of dictionary {{d}}. #} |