11Container arm for map operation arms. A map is a set of key, value
12pairs. The contained arms inherit it's sample map, `a`.
16 > ~(. by (mo (limo [%a 1] [%b 2] ~)))
17 <19.irb [nlr([p={%a %b} q=@ud]) <414.rvm 101.jzo 1.ypj %164>]>
19------------------------------------------------------------------------
31 ?&((b q.n.a) $(a l.a) $(a r.a))
35Computes the logical AND on the results of slamming every element in map
36`a` with gate `b`. Produces a loobean.
42 > =b (mo `(list {@t *})`[['a' 1] ['b' [2 3]] ~])
43 > (~(all by b) |=(a/* ?@(a & |)))
45 > =a (mo `(list {@t @u})`[['a' 1] ['b' 2] ['c' 3] ['d' 4] ['e' 5] ~])
46 > (~(all by a) |=(a/@ (lte a 6)))
48 > (~(all by a) |=(a/@ (lte a 4)))
51------------------------------------------------------------------------
63 ?|((b q.n.a) $(a l.a) $(a r.a))
65Computes the logical OR on the results of slamming every element with
66gate `b`. Produces a loobean.
72 > =b (mo `(list {@t *})`[['a' 1] ['b' [2 3]] ~])
73 > (~(all by b) |=(a/* ?@(a & |)))
75 > =a (mo `(list {@t @u})`[['a' 1] ['b' 2] ['c' 3] ['d' 4] ['e' 5] ~])
76 > (~(any by a) |=(a=@ (lte a 4)))
79------------------------------------------------------------------------
85 +- del :: delete at key b
98 ?: (vor p.n.l.a p.n.r.a)
99 [n.l.a l.l.a $(l.a r.l.a)]
100 [n.r.a $(r.a l.r.a) r.r.a]
103Produces map `a` with the element located at key `b` removed.
107`b` is a key as a noun.
109 > =b (mo `(list {@t *})`[['a' 1] ['b' [2 3]] ~])
113------------------------------------------------------------------------
119 +- dig :: axis of b key
124 ?: =(b p.n.a) [~ u=(peg c 2)]
126 $(a l.a, c (peg c 6))
127 $(a r.a, c (peg c 7))
131Produce the axis of key `b` within map `a`.
135`b` is a key as a noun.
137 > =b (mo `(list {@t *})`[['a' 1] ['b' [2 3]] ~])
141------------------------------------------------------------------------
147 +- gas :: concatenate
149 |= b/(list _?>(?=(^ a) n.a))
153 $(b t.b, a (put i.b))
157Insert a list of key-value pairs `b` into map `a`.
161`b` is a list of cells of key-value nouns `p` and `q`.
163 > =a (mo `(list {@t *})`[[`a` 1] [`b` 2] ~])
164 > =b `(list {@t *})`[[`c` 3] [`d` 4] ~]
166 {[p=`d` q=4] [p=`a` q=1] [p=`c` q=3] [p=`b` q=2]}
168------------------------------------------------------------------------
174 +- get :: unit value by key
177 |- ^- ?(~ [~ u=_?>(?=(^ a) q.n.a)])
186Produce the unit value of the value located at key `b` within map `a`.
190`b` is a key as a noun
192 > =b (mo `(list {@t *})`[['a' 1] ['b' [2 3]] ~])
196------------------------------------------------------------------------
206Produce the value located at key `b` within map `a`. Crash if key `b`
213 > =m (mo `(list {@t *})`[['a' 1] ['b' 2] ~])
215 {[p='a' q=1] [p='b' q=2]}
223------------------------------------------------------------------------
229 +- has :: key existence check
235Checks whether map `a` contains an element with key `b`, producing a
240`b` is a key as a noun.
242 > =b (mo `(list {@t *})`[['a' 1] ['b' [2 3]] ~])
248------------------------------------------------------------------------
254 +- int :: intersection
264 [n.b $(a l.a, b l.b) $(a r.a, b r.b)]
266 %- uni(a $(a l.a, b [n.b l.b ~])) $(b r.b)
267 %- uni(a $(a r.a, b [n.b ~ r.b])) $(b l.b)
269 [n.b $(b l.b, a l.a) $(b r.b, a r.a)]
271 %- uni(a $(b l.b, a [n.a l.a ~])) $(a r.a)
272 %- uni(a $(b r.b, a [n.a ~ r.a])) $(a l.a)
275Produces a map of the (key) intersection between two maps of the same
276type, `a` and `b`. If both maps have an identical key that point to
277different values, the element from map `b` is used.
283 > =n (mo `(list {@t *})`[['a' 1] ['c' 3] ~])
285 {[p='a' q=1] [p='c' q=3]}
287 {[p='a' q=1] [p='b' q=2]}
290 ~ravpel-holber/try=> =p (mo `(list {@t *})`[['a' 2] ['b' 2] ~])
292 {[p='a' q=2] [p='b' q=2]}
295 > =q (mo `(list {@t *})`[['a' 2] ['c' 2] ~])
297 {[p='a' q=2] [p='b' q=2]}
299 {[p='a' q=2] [p='b' q=2]}
300 > =o (mo `(list {@t *})`[['c' 3] ['d' 4] ~])
305------------------------------------------------------------------------
311 +- mar :: add with validation
312 |* [b=_?>(?=(^ a) p.n.a) c=(unit ,_?>(?=(^ a) q.n.a))]
317Produces map `a` with the addition of a key-value pair, where the value
320Accept a noun and a unit of a noun of the type of the map's keys and
321values, respectively. Validate that the value is not null and put the
322pair in the map. If the value is null, delete the key.
324XX This arm is broken, asana task 15186618346453
327 {[p='a' q=1] [p='b' q=2]}
328 > (~(mar by m) 'c' (some 3))
332 > (~(mar by m) 'c' ~)
336 > (~(mar by m) 'b' ~)
341------------------------------------------------------------------------
347 +- put :: adds key-value pair
362 [n.d l.d [n.a r.d r.a]]
367 [n.d [n.a l.a l.d] r.d]
370Produces `a` with the addition of the key-value pair of `b` and `c`.
374`b` is a key of the same type as the keys in `a`.
376`c` is a value of the same type of the values in `a`.
379 {[p='a' q=1] [p='b' q=2]}
380 > (~(put by m) 'c' 3)
381 {[p='a' q=1] [p='c' q=3] [p='b' q=2]}
382 > (~(put by m) "zod" 26)
385 > (~(put by m) 'a' 2)
386 {[p='a' q=2] [p='b' q=2]}
388------------------------------------------------------------------------
392 +- rep :: replace by product
396 $(a r.a, +<+.b $(a l.a, +<+.b (b n.a +<+.b)))
399Accumulate using gate from values in map
401XX interface changing.
403------------------------------------------------------------------------
407 +- rib :: transform + product
418Replace values with accumulator
420XX interface changing, possibly disappearing
422------------------------------------------------------------------------
428 +- run :: apply gate to values
432 [n=[p=p.n.a q=(b q.n.a)] l=$(a l.a) r=$(a r.a)]
434Iterates over every value in set `a` using gate `b`. Produces a map.
441 {[p='a' q=1] [p='b' q=2]}
442 > ^+(m (~(run by m) dec))
443 {[p='a' q=0] [p='b' q=1]}
444 > `(map @tas @t)`(~(run by m) (cury scot %ux))
445 {[p=%a q='0x1'] [p=%b q='0x2']}
447------------------------------------------------------------------------
453 +- tap :: listify pairs
455 |= b/(list _?>(?=(^ a) n.a))
459 $(a r.a, b [n.a $(a l.a)])
462Produces the list of all elements in map `a` that is prepended to list
463`b`, which is empty by default.
469 {[p='a' q=1] [p='b' q=2]}
471 [[98 2] [[97 1] 0 0] 0]
473 ~[[p='b' q=2] [p='a' q=1]]
477------------------------------------------------------------------------
483 +- uni :: union, merge
493 [n.b $(a l.a, b l.b) $(a r.a, b r.b)]
495 $(a [n.a $(a l.a, b [n.b l.b ~]) r.a], b r.b)
496 $(a [n.a l.a $(a r.a, b [n.b ~ r.b])], b l.b)
498 [n.b $(b l.b, a l.a) $(b r.b, a r.a)]
500 $(b [n.b $(b l.b, a [n.a l.a ~]) r.b], a r.a)
501 $(b [n.b l.b $(b r.b, a [n.a ~ r.a])], a l.a)
503Produces a map of the union between the keys of `a` and `b`. If `b`
504shares a key with `a`, the tuple from `a` is preserved.
511 {[p='a' q=1] [p='b' q=2]}
513 {[p='d' q=4] [p='c' q=3]}
515 {[p='d' q=4] [p='a' q=1] [p='c' q=3] [p='b' q=2]}
517 {[p='a' q=1] [p='b' q=2]}
519 {[p='a' q=1] [p='c' q=9]}
521 {[p='d' q=4] [p='a' q=1] [p='c' q=3]}
522 > =n (mo `(list ,[@t *])`[['a' 1] ['c' 9] ~])
524 {[p='a' q=1] [p='c' q=9]}
526 {[p='d' q=4] [p='a' q=1] [p='c' q=9]}
528------------------------------------------------------------------------
534 +- urn :: apply gate to nodes
538 [n=[p=p.n.a q=(b p.n.a q.n.a)] l=$(a l.a) r=$(a r.a)]
540Iterates over every value in map `a` using gate `b`, which accepts both
541the key and the value of each element as its sample.
545`b` is a wet gate that accepts two nouns (a key and a value) and
546produces a noun (the new value).
549 {[p='a' q=1] [p='b' q=2]}
550 > (~(urn by m) |=(a=[p=* q=*] q.a))
551 {[p='a' q=1] [p='b' q=2]}
552 > (~(urn by m) |=(a=[p=* q=*] 7))
553 {[p='a' q=7] [p='b' q=7]}
554 > (~(urn by m) |=(a=[p=* q=*] p.a))
555 {[p='a' q=97] [p='b' q=98]}
557------------------------------------------------------------------------
563 +- wyt :: depth of map
565 ?~(a 0 +((add $(a l.a) $(a r.a))))
567Produce the depth of the tree map `a`.
572 {[p='a' q=1] [p='b' q=2]}
574 {[p='d' q=4] [p='c' q=3]}
579 > ~(wyt by (~(uni by m) o))
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