2title = "2j: Jar and Jug Logic"
15A container arm for `++jar` operation arms. A `++jar` is a `++map` of
16`++list`s. The contained arms inherit the sample jar.
21> ~(. ja (my [a+1 b+2 ~]))
23 [ a=?(%~ [n=[?(p=%a p=%b) q=@ud] l=nlr([p=?(%a %b) q=@ud]) r=nlr([p=?(%a %b) q=@ud])])
24 <123.zao 45.xig 1.pnw %140>
35 ++ get :: gets list by key
45`b` is a key of the same type as the keys in `a`.
49A list retrieved from jar `a` using the key `b`.
54> =l (my [['a' (ly 1 2 3 ~)] ['b' (ly 4 5 6 ~)]~])
56[n=[p='b' q=[i=4 t=~[5 6]]] l={} r={[p='a' q=[i=1 t=~[2 3]]]}]
77 ++ add :: adds key-list pair
87`b` is a key of the same type as the keys in `a`.
89`c` is a value of the same type as the values in `a`.
94> =l (my [['a' (ly 1 2 3 ~)] ['b' (ly 4 5 6 ~)]~])
96[n=[p='b' q=[i=4 t=~[5 6]]] l={} r={[p='a' q=[i=1 t=~[2 3]]]}]
97> (~(add ja l) 'a' 100)
98[ n=[p='b' q=[i=4 t=[i=5 t=~[6]]]]
100 r=[n=[p='a' q=[i=100 t=[i=1 t=~[2 3]]]] l=~ r=~]
102> (~(add ja l) 'a' 100)
103[n=[p='b' q=[i=4 t=[i=5 t=~[6]]]] l=~ r=[n=[p='a' q=[i=100 t=[i=1 t=~[2 3]]]] l=~ r=~]]
105[n=[p='b' q=[i=7 t=[i=4 t=~[5 6]]]] l=~ r=[n=[p='a' q=[i=1 t=[i=2 t=~[3]]]] l=~ r=~]]
107[ n=[p='b' q=[i=4 t=[i=5 t=~[6]]]]
109 r=[n=[p='c' q=[i=7 t=~]] l=[n=[p='a' q=[i=1 t=~[2 3]]] l={} r={}] r=~]
111> (~(add ja l) 'c' (ly 7 8 9 ~))
127Container arm for jug operation arms. A `++jug` is a `++map` of
128`++sets`. The contained arms inherit its sample jug, `a`.
133> ~(. ju (my [[a (sy 1 ~)] [b (sy 2 ~)] ~]))
138 [ n=[p=@ub ?(q=%~ q=[?(n=@ud #!) l=nlr(?(@ud #!)) r=nlr(?(@ud #!))])]
139 l=nlr([p=@ub q=?(%~ [?(n=@ud #!) l=nlr(?(@ud #!)) r=nlr(?(@ud #!))])])
140 r=nlr([p=@ub q=?(%~ [?(n=@ud #!) l=nlr(?(@ud #!)) r=nlr(?(@ud #!))])])
143 <123.zao 45.xig 1.pnw %140>
154 ++ del :: del key-set pair
164Produces jug `a` with value `c` removed from set located at key `b`.
168`b` is a key of the same type as the keys in `a`.
170`c` is the value of the same type of the keys in `a` that is to be
175 [[p='a' q={1 3 2}] [p='b' q={5 4 6}]}
177 > (~(del ju s) 'a' 1)
178 {[p='a' q={3 2}] [p='b' q={5 4 6}]}
180 > (~(del ju s) 'c' 7)
181 {[p='a' q={1 3 2}] [p='b' q={5 4 6}]}
191 ++ get :: gets set by key
197Produces a set retrieved from jar `a` using key `b`.
201`b` is a key of the same type as the keys in `a`.
205 {[p='a' q={1 3 2}] [p='b' q={5 4 6}]}
221 ++ has :: existence check
224 (~(has in (get b)) c)
227Computes whether a value `c` exists within the set located at key `b`
228with jar `a`. Produces a loobean.
232`b` is a key as a noun.
234`c` is a value as a noun.
238 {[p='a' q={1 3 2}] [p='b' q={5 4 6}]}
239 > (~(has ju s) 'a' 3)
241 > (~(has ju s) 'b' 6)
243 > (~(has ju s) 'a' 7)
245 > (~(has jus s) 'c' 7)
249 > (~(has ju s) 'c' 7)
260 ++ put :: add key-set pair
264 (~(put by a) b (~(put in d) c))
267Produces jar `a` with `c` added to the set value located at key `b`.
271`b` is a key as a noun.
277 [p='a' q=[1 3 2]] [p='b' q=[5 4 6]]]
279 > (~(put ju s) 'a' 7)
280 {[p='a' q={7 1 3 2}] [p='b' q={5 4 6}]}
282 > (~(put ju s) 'a' 1)
283 {[p='a' q={1 3 2}] [p='b' q={5 4 6}]}
285 > (~(put ju s) 'c' 7)
286 {[p='a' q={1 3 2}] [p='c' q={7}] [p='b' q={5 4 6}]}
keysesc to close
- j k
- move down, up
- enter
- open
- esc
- back, or up a level
- 1 2 3 4
- readme, files, commits, refs
- /
- filter
- y
- copy the clone command
- c
- compare the chosen commit with another (or shift-click both)
- ?
- show or hide this list