@@ -5,12 +5,13 @@ Map operations
6 ++ by :: map engine
6 ++ by :: map engine
8− |/ a=(map)
8+ |_ a/(map)
10Container arm for map operation arms. A map is a set of key, value
11Container arm for map operation arms. A map is a set of key, value
11−pairs. The contained arms inherit it's [sample]() [map](), `a`.
12+pairs. The contained arms inherit it's sample map, `a`.
13−`a` is a [map]().
14+`a` is a map.
15 ~zod/try=> ~(. by (mo (limo [%a 1] [%b 2] ~)))
16 ~zod/try=> ~(. by (mo (limo [%a 1] [%b 2] ~)))
16 <19.irb [nlr([p={%a %b} q=@ud]) <414.rvm 101.jzo 1.ypj %164>]>
17 <19.irb [nlr([p={%a %b} q=@ud]) <414.rvm 101.jzo 1.ypj %164>]>
@@ -23,26 +24,28 @@ Logical AND
24 +- all :: logical AND
25 +- all :: logical AND
26− |* b=$+(* ?)
27+ |* b/$-(* ?)
30 ?&((b q.n.a) $(a l.a) $(a r.a))
31 ?&((b q.n.a) $(a l.a) $(a r.a))
32Computes the logical AND on the results of slamming every element in map
35Computes the logical AND on the results of slamming every element in map
33`a` with gate `b`. Produces a loobean.
36`a` with gate `b`. Produces a loobean.
35−`a` is a [map]().
38+`a` is a map.
37−`b` is a [wet gate]().
40+`b` is a wet gate.
39− ~zod/try=> =b (mo `(list ,[@t *])`[['a' 1] ['b' [2 3]] ~])
42+ ~zod/try=> =b (mo `(list {@t *})`[['a' 1] ['b' [2 3]] ~])
40− ~zod/try=> (~(all by b) |=(a=* ?@(a & |)))
43+ ~zod/try=> (~(all by b) |=(a/* ?@(a & |)))
42− ~zod/try=> =a (mo `(list ,[@t @u])`[['a' 1] ['b' 2] ['c' 3] ['d' 4] ['e' 5] ~])
45+ ~zod/try=> =a (mo `(list {@t @u})`[['a' 1] ['b' 2] ['c' 3] ['d' 4] ['e' 5] ~])
43− ~zod/try=> (~(all by a) |=(a=@ (lte a 6)))
46+ ~zod/try=> (~(all by a) |=(a/@ (lte a 6)))
45− ~zod/try=> (~(all by a) |=(a=@ (lte a 4)))
48+ ~zod/try=> (~(all by a) |=(a/@ (lte a 4)))
48------------------------------------------------------------------------
51------------------------------------------------------------------------
@@ -62,14 +65,14 @@ Logical OR
62Computes the logical OR on the results of slamming every element with
65Computes the logical OR on the results of slamming every element with
63gate `b`. Produces a loobean.
66gate `b`. Produces a loobean.
65−`a` is a [map]().
68+`a` is a map.
67−`b` is a [wet gate]().
70+`b` is a wet gate.
69− ~zod/try=> =b (mo `(list ,[@t *])`[['a' 1] ['b' [2 3]] ~])
72+ ~zod/try=> =b (mo `(list {@t *})`[['a' 1] ['b' [2 3]] ~])
70− ~zod/try=> (~(all by b) |=(a=* ?@(a & |)))
73+ ~zod/try=> (~(all by b) |=(a/* ?@(a & |)))
72− ~zod/try=> =a (mo `(list ,[@t @u])`[['a' 1] ['b' 2] ['c' 3] ['d' 4] ['e' 5] ~])
75+ ~zod/try=> =a (mo `(list {@t @u})`[['a' 1] ['b' 2] ['c' 3] ['d' 4] ['e' 5] ~])
73 ~zod/try=> (~(any by a) |=(a=@ (lte a 4)))
76 ~zod/try=> (~(any by a) |=(a=@ (lte a 4)))
@@ -81,7 +84,7 @@ Delete
82 +- del :: delete at key b
85 +- del :: delete at key b
@@ -89,20 +92,21 @@ Delete
89 ?: (gor b p.n.a)
92 ?: (gor b p.n.a)
90 [n.a $(a l.a) r.a]
93 [n.a $(a l.a) r.a]
91 [n.a l.a $(a r.a)]
94 [n.a l.a $(a r.a)]
92− |- ^- ?(~ _a)
95+ |- ^- {$?($~ _a)}
93 ?~ l.a r.a
96 ?~ l.a r.a
94 ?~ r.a l.a
97 ?~ r.a l.a
95 ?: (vor p.n.l.a p.n.r.a)
98 ?: (vor p.n.l.a p.n.r.a)
96 [n.l.a l.l.a $(l.a r.l.a)]
99 [n.l.a l.l.a $(l.a r.l.a)]
97 [n.r.a $(r.a l.r.a) r.r.a]
100 [n.r.a $(r.a l.r.a) r.r.a]
99Produces map `a` with the element located at key `b` removed.
103Produces map `a` with the element located at key `b` removed.
101−`a` is a [map]().
105+`a` is a map.
103−`b` is a key as a [noun]().
107+`b` is a key as a noun.
105− ~zod/try=> =b (mo `(list ,[@t *])`[['a' 1] ['b' [2 3]] ~])
109+ ~zod/try=> =b (mo `(list {@t *})`[['a' 1] ['b' [2 3]] ~])
106 ~zod/try=> (~(del by b) `a`)
110 ~zod/try=> (~(del by b) `a`)
107 {[p=`b` q=[2 3]]}
111 {[p=`b` q=[2 3]]}
@@ -112,23 +116,25 @@ Produces map `a` with the element located at key `b` removed.
113Axis of key
117Axis of key
115− +- dig :: axis of key
119+ +- dig :: axis of b key
118− |- ^- (unit ,@)
122+ |- ^- (unit @)
120 ?: =(b p.n.a) [~ u=(peg c 2)]
124 ?: =(b p.n.a) [~ u=(peg c 2)]
121 ?: (gor b p.n.a)
125 ?: (gor b p.n.a)
122 $(a l.a, c (peg c 6))
126 $(a l.a, c (peg c 6))
123 $(a r.a, c (peg c 7))
127 $(a r.a, c (peg c 7))
125Produce the axis of key `b` within map `a`.
131Produce the axis of key `b` within map `a`.
127−`a` is a [map]().
133+`a` is a map.
129−`b` is a key as a [noun]().
135+`b` is a key as a noun.
131− ~zod/try=> =b (mo `(list ,[@t *])`[['a' 1] ['b' [2 3]] ~])
137+ ~zod/try=> =b (mo `(list {@t *})`[['a' 1] ['b' [2 3]] ~])
132 ~zod/try=> (~(dig by b) `b`)
138 ~zod/try=> (~(dig by b) `b`)
@@ -140,21 +146,22 @@ Concatenate
141 +- gas :: concatenate
147 +- gas :: concatenate
143− |* b=(list ,[p=* q=*])
144− => .(b `(list ,_?>(?=(^ a) n.a))`b)
149+ |= b/(list _?>(?=(^ a) n.a))
148− $(b t.b, a (put(+< a) p.i.b q.i.b))
153+ $(b t.b, a (put i.b))
150Insert a list of key-value pairs `b` into map `a`.
157Insert a list of key-value pairs `b` into map `a`.
152−`a` is a [map]().
159+`a` is a map.
154−`b` is a [list]() of [cells]() of key-value nouns `p` and `q`.
161+`b` is a list of cells of key-value nouns `p` and `q`.
156− ~zod/try=> =a (mo `(list ,[@t *])`[[`a` 1] [`b` 2] ~])
163+ ~zod/try=> =a (mo `(list {@t *})`[[`a` 1] [`b` 2] ~])
157− ~zod/try=> =b `(list ,[@t *])`[[`c` 3] [`d` 4] ~]
164+ ~zod/try=> =b `(list {@t *})`[[`c` 3] [`d` 4] ~]
158 ~zod/try=> (~(gas by a) b)
165 ~zod/try=> (~(gas by a) b)
159 {[p=`d` q=4] [p=`a` q=1] [p=`c` q=3] [p=`b` q=2]}
166 {[p=`d` q=4] [p=`a` q=1] [p=`c` q=3] [p=`b` q=2]}
@@ -178,11 +185,11 @@ Grab unit value
179Produce the unit value of the value located at key `b` within map `a`.
186Produce the unit value of the value located at key `b` within map `a`.
181−`a` is a [map]()
188+`a` is a map
183−`b` is a [key]() as a [noun]()
190+`b` is a key as a noun
185− ~zod/try=> =b (mo `(list ,[@t *])`[['a' 1] ['b' [2 3]] ~])
192+ ~zod/try=> =b (mo `(list {@t *})`[['a' 1] ['b' [2 3]] ~])
186 ~zod/try=> (~(get by b) `b`)
193 ~zod/try=> (~(get by b) `b`)
187 [~ [2 3]]
194 [~ [2 3]]
@@ -193,18 +200,17 @@ Produce the unit value of the value located at key `b` within map `a`.
197− %- need
204+ (need (get b))
200Produce the value located at key `b` within map `a`. Crash if key `b`
206Produce the value located at key `b` within map `a`. Crash if key `b`
201does not exist.
207does not exist.
203−`a` is a [map]().
209+`a` is a map.
205−`b` is a [key]().
211+`b` is a key.
207− ~zod/try=> =m (mo `(list ,[@t *])`[['a' 1] ['b' 2] ~])
213+ ~zod/try=> =m (mo `(list {@t *})`[['a' 1] ['b' 2] ~])
208 ~zod/try=> m
214 ~zod/try=> m
209 {[p='a' q=1] [p='b' q=2]}
215 {[p='a' q=1] [p='b' q=2]}
210 ~zod/try=> (~(get by m) 'a')
216 ~zod/try=> (~(get by m) 'a')
@@ -222,17 +228,18 @@ Key existence check
223 +- has :: key existence check
229 +- has :: key existence check
226− !=(~ (get(+< a) b))
232+ !=(~ (get b))
228Checks whether map `a` contains an element with key `b`, producing a
235Checks whether map `a` contains an element with key `b`, producing a
231−`a` is a [map]().
238+`a` is a map.
233−`b` is a key as a [noun]().
240+`b` is a key as a noun.
235− ~zod/try=> =b (mo `(list ,[@t *])`[['a' 1] ['b' [2 3]] ~])
242+ ~zod/try=> =b (mo `(list {@t *})`[['a' 1] ['b' [2 3]] ~])
236 ~zod/try=> (~(has by b) `b`)
243 ~zod/try=> (~(has by b) `b`)
238 ~zod/try=> (~(has by b) `c`)
245 ~zod/try=> (~(has by b) `c`)
@@ -246,7 +253,7 @@ Intersection
247 +- int :: intersection
254 +- int :: intersection
@@ -255,41 +262,42 @@ Intersection
255 ?: (vor p.n.a p.n.b)
262 ?: (vor p.n.a p.n.b)
256 ?: =(p.n.b p.n.a)
263 ?: =(p.n.b p.n.a)
257 [n.b $(a l.a, b l.b) $(a r.a, b r.b)]
264 [n.b $(a l.a, b l.b) $(a r.a, b r.b)]
258− ?: (hor p.n.b p.n.a)
265+ ?: (gor p.n.b p.n.a)
259− %- uni(+< $(a l.a, b [n.b l.b ~])) $(b r.b)
266+ %- uni(a $(a l.a, b [n.b l.b ~])) $(b r.b)
260− %- uni(+< $(a r.a, b [n.b ~ r.b])) $(b l.b)
267+ %- uni(a $(a r.a, b [n.b ~ r.b])) $(b l.b)
261 ?: =(p.n.a p.n.b)
268 ?: =(p.n.a p.n.b)
262 [n.b $(b l.b, a l.a) $(b r.b, a r.a)]
269 [n.b $(b l.b, a l.a) $(b r.b, a r.a)]
263− ?: (hor p.n.a p.n.b)
270+ ?: (gor p.n.a p.n.b)
264− %- uni(+< $(b l.b, a [n.a l.a ~])) $(a r.a)
271+ %- uni(a $(b l.b, a [n.a l.a ~])) $(a r.a)
265− %- uni(+< $(b r.b, a [n.a ~ r.a])) $(a l.a)
272+ %- uni(a $(b r.b, a [n.a ~ r.a])) $(a l.a)
267Produces a map of the (key) intersection between two maps of the same
275Produces a map of the (key) intersection between two maps of the same
268type, `a` and `b`. If both maps have an identical key that point to
276type, `a` and `b`. If both maps have an identical key that point to
269different values, the element from map `b` is used.
277different values, the element from map `b` is used.
271−`a` is a [map]().
279+`a` is a map.
273−`b` is a [map]().
281+`b` is a map.
275− ~zod/try=> =n (mo `(list ,[@t *])`[['a' 1] ['c' 3] ~])
283+ ~zod/try=> =n (mo `(list {@t *})`[['a' 1] ['c' 3] ~])
276 ~zod/try=> n
284 ~zod/try=> n
277 {[p='a' q=1] [p='c' q=3]}
285 {[p='a' q=1] [p='c' q=3]}
278 ~zod/try=> m
286 ~zod/try=> m
279 {[p='a' q=1] [p='b' q=2]}
287 {[p='a' q=1] [p='b' q=2]}
280 ~zod/try=> (~(int by m) n)
288 ~zod/try=> (~(int by m) n)
281 {[p='a' q=1]}
289 {[p='a' q=1]}
282− ~ravpel-holber/try=> =p (mo `(list ,[@t *])`[['a' 2] ['b' 2] ~])
290+ ~ravpel-holber/try=> =p (mo `(list {@t *})`[['a' 2] ['b' 2] ~])
283 ~zod/try=> p
291 ~zod/try=> p
284 {[p='a' q=2] [p='b' q=2]}
292 {[p='a' q=2] [p='b' q=2]}
285 ~zod/try=> (~(int by p) n)
293 ~zod/try=> (~(int by p) n)
286 {[p='a' q=2]}
294 {[p='a' q=2]}
287− ~zod/try=> =q (mo `(list ,[@t *])`[['a' 2] ['c' 2] ~])
295+ ~zod/try=> =q (mo `(list {@t *})`[['a' 2] ['c' 2] ~])
288 ~zod/try=> q
296 ~zod/try=> q
289 {[p='a' q=2] [p='b' q=2]}
297 {[p='a' q=2] [p='b' q=2]}
290 ~zod/try=> (~(int by p) q)
298 ~zod/try=> (~(int by p) q)
291 {[p='a' q=2] [p='b' q=2]}
299 {[p='a' q=2] [p='b' q=2]}
292− ~zod/try=> =o (mo `(list ,[@t *])`[['c' 3] ['d' 4] ~])
300+ ~zod/try=> =o (mo `(list {@t *})`[['c' 3] ['d' 4] ~])
293 ~zod/try=> (~(int by m) o)
301 ~zod/try=> (~(int by m) o)
@@ -338,7 +346,7 @@ Add key-value pair
339 +- put :: adds key-value pair
347 +- put :: adds key-value pair
341− |* [b=* c=*]
349+ |* {b/* c/*}
344 [[b c] ~ ~]
352 [[b c] ~ ~]
@@ -357,10 +365,11 @@ Add key-value pair
357 ?: (vor p.n.a p.n.d)
365 ?: (vor p.n.a p.n.d)
358 [n.a l.a d]
366 [n.a l.a d]
359 [n.d [n.a l.a l.d] r.d]
367 [n.d [n.a l.a l.d] r.d]
361Produces `a` with the addition of the key-value pair of `b` and `c`.
370Produces `a` with the addition of the key-value pair of `b` and `c`.
363−`a` is a [map]().
372+`a` is a map.
365`b` is a key of the same type as the keys in `a`.
374`b` is a key of the same type as the keys in `a`.
@@ -381,10 +390,11 @@ Produces `a` with the addition of the key-value pair of `b` and `c`.
381### `+-rep:by`
390### `+-rep:by`
383 +- rep :: replace by product
392 +- rep :: replace by product
384− |* [b=* c=_,*]
393+ |* b/_|=({* *} +<+)
386− ?~ a b
395+ ?~ a +<+.b
387− $(a r.a, b $(a l.a, b (c q.n.a b)))
396+ $(a r.a, +<+.b $(a l.a, +<+.b (b n.a +<+.b)))
389Accumulate using gate from values in map
399Accumulate using gate from values in map
@@ -395,7 +405,7 @@ XX interface changing.
395### `+-rib:by`
405### `+-rib:by`
397 +- rib :: transform + product
407 +- rib :: transform + product
398− |* [b=* c=_,*]
408+ |* {b/* c/$-(* *)}
399 |- ^+ [b a]
409 |- ^+ [b a]
400 ?~ a [b ~]
410 ?~ a [b ~]
401 =+ d=(c n.a b)
411 =+ d=(c n.a b)
@@ -403,6 +413,7 @@ XX interface changing.
403 =+ e=$(a l.a, b -.d)
413 =+ e=$(a l.a, b -.d)
404 =+ f=$(a r.a, b -.e)
414 =+ f=$(a r.a, b -.e)
405 [-.f [n.a +.e +.f]]
415 [-.f [n.a +.e +.f]]
407Replace values with accumulator
418Replace values with accumulator
@@ -414,23 +425,23 @@ XX interface changing, possibly disappearing
415Transform values
426Transform values
417− +- run :: turns to tuples
428+ +- run :: apply gate to values
418− |* b=_,*
429+ |* b/$-(* *)
421− a(n (b q.n.a), l $(a l.a), r $(a r.a))
432+ [n=[p=p.n.a q=(b q.n.a)] l=$(a l.a) r=$(a r.a)]
423Iterates over every value in set `a` using gate `b`. Produces a map.
434Iterates over every value in set `a` using gate `b`. Produces a map.
425−`a` is a [map]().
436+`a` is a map.
427−`b` is a [wet gate]().
438+`b` is a wet gate.
429 ~zod/try=> m
440 ~zod/try=> m
430 {[p='a' q=1] [p='b' q=2]}
441 {[p='a' q=1] [p='b' q=2]}
431 ~zod/try=> ^+(m (~(run by m) dec))
442 ~zod/try=> ^+(m (~(run by m) dec))
432 {[p='a' q=0] [p='b' q=1]}
443 {[p='a' q=0] [p='b' q=1]}
433− ~zod/try=> `(map ,@tas ,@t)`(~(run by m) (cury scot %ux))
444+ ~zod/try=> `(map @tas @t)`(~(run by m) (cury scot %ux))
434 {[p=%a q='0x1'] [p=%b q='0x2']}
445 {[p=%a q='0x1'] [p=%b q='0x2']}
436------------------------------------------------------------------------
447------------------------------------------------------------------------
@@ -441,18 +452,19 @@ Listify pairs
442 +- tap :: listify pairs
453 +- tap :: listify pairs
444− |= b=(list ,_?>(?=(^ a) n.a))
455+ |= b/(list _?>(?=(^ a) n.a))
448 $(a r.a, b [n.a $(a l.a)])
459 $(a r.a, b [n.a $(a l.a)])
450Produces the list of all elements in map `a` that is prepended to list
462Produces the list of all elements in map `a` that is prepended to list
451`b`, which is empty by default.
463`b`, which is empty by default.
453−`a` is a [map]().
465+`a` is a map.
455−`b` is a [list]().
467+`b` is a list.
457 {[p='a' q=1] [p='b' q=2]}
469 {[p='a' q=1] [p='b' q=2]}
458 ~zod/try=> `*`m
470 ~zod/try=> `*`m
@@ -470,7 +482,7 @@ Union
471 +- uni :: union, merge
483 +- uni :: union, merge
@@ -479,21 +491,21 @@ Union
479 ?: (vor p.n.a p.n.b)
491 ?: (vor p.n.a p.n.b)
480 ?: =(p.n.b p.n.a)
492 ?: =(p.n.b p.n.a)
481 [n.b $(a l.a, b l.b) $(a r.a, b r.b)]
493 [n.b $(a l.a, b l.b) $(a r.a, b r.b)]
482− ?: (hor p.n.b p.n.a)
494+ ?: (gor p.n.b p.n.a)
483 $(a [n.a $(a l.a, b [n.b l.b ~]) r.a], b r.b)
495 $(a [n.a $(a l.a, b [n.b l.b ~]) r.a], b r.b)
484 $(a [n.a l.a $(a r.a, b [n.b ~ r.b])], b l.b)
496 $(a [n.a l.a $(a r.a, b [n.b ~ r.b])], b l.b)
485 ?: =(p.n.a p.n.b)
497 ?: =(p.n.a p.n.b)
486 [n.b $(b l.b, a l.a) $(b r.b, a r.a)]
498 [n.b $(b l.b, a l.a) $(b r.b, a r.a)]
487− ?: (hor p.n.a p.n.b)
499+ ?: (gor p.n.a p.n.b)
488 $(b [n.b $(b l.b, a [n.a l.a ~]) r.b], a r.a)
500 $(b [n.b $(b l.b, a [n.a l.a ~]) r.b], a r.a)
489 $(b [n.b l.b $(b r.b, a [n.a ~ r.a])], a l.a)
501 $(b [n.b l.b $(b r.b, a [n.a ~ r.a])], a l.a)
491Produces a map of the union between the keys of `a` and `b`. If `b`
503Produces a map of the union between the keys of `a` and `b`. If `b`
492shares a key with `a`, the tuple from `a` is preserved.
504shares a key with `a`, the tuple from `a` is preserved.
494−`a` is a [map]().
506+`a` is a map.
496−`b` is a [map]().
508+`b` is a map.
498 ~zod/try=> m
510 ~zod/try=> m
499 {[p='a' q=1] [p='b' q=2]}
511 {[p='a' q=1] [p='b' q=2]}
@@ -519,8 +531,8 @@ shares a key with `a`, the tuple from `a` is preserved.
520Turn (with key)
532Turn (with key)
522− +- urn :: turn
534+ +- urn :: apply gate to nodes
523− |* b=$+([* *] *)
535+ |* b/$-({* *} *)
526 [n=[p=p.n.a q=(b p.n.a q.n.a)] l=$(a l.a) r=$(a r.a)]
538 [n=[p=p.n.a q=(b p.n.a q.n.a)] l=$(a l.a) r=$(a r.a)]
@@ -528,9 +540,9 @@ Turn (with key)
528Iterates over every value in map `a` using gate `b`, which accepts both
540Iterates over every value in map `a` using gate `b`, which accepts both
529the key and the value of each element as its sample.
541the key and the value of each element as its sample.
531−`a` is a [map]().
543+`a` is a map.
533−`b` is a [wet gate]() that accepts two nouns (a key and a value) and
545+`b` is a wet gate that accepts two nouns (a key and a value) and
534produces a noun (the new value).
546produces a noun (the new value).
536 ~zod/try=> m
548 ~zod/try=> m
@@ -554,7 +566,7 @@ Depth
555Produce the depth of the tree map `a`.
567Produce the depth of the tree map `a`.
557−`a` is a [map]().
569+`a` is a map.
559 ~zod/try=> m
571 ~zod/try=> m
560 {[p='a' q=1] [p='b' q=2]}
572 {[p='a' q=1] [p='b' q=2]}