16Container arm for map operation arms. A map is a set of key, value
17pairs. The contained arms inherit it's sample map, `a`.
21 > ~(. by (mo (limo [%a 1] [%b 2] ~)))
22 <19.irb [nlr([p={%a %b} q=@ud]) <414.rvm 101.jzo 1.ypj %164>]>
24------------------------------------------------------------------------
36 ?&((b q.n.a) $(a l.a) $(a r.a))
40Computes the logical AND on the results of slamming every element in map
41`a` with gate `b`. Produces a loobean.
47 > =b (mo `(list {@t *})`[['a' 1] ['b' [2 3]] ~])
48 > (~(all by b) |=(a/* ?@(a & |)))
50 > =a (mo `(list {@t @u})`[['a' 1] ['b' 2] ['c' 3] ['d' 4] ['e' 5] ~])
51 > (~(all by a) |=(a/@ (lte a 6)))
53 > (~(all by a) |=(a/@ (lte a 4)))
56------------------------------------------------------------------------
68 ?|((b q.n.a) $(a l.a) $(a r.a))
70Computes the logical OR on the results of slamming every element with
71gate `b`. Produces a loobean.
77 > =b (mo `(list {@t *})`[['a' 1] ['b' [2 3]] ~])
78 > (~(all by b) |=(a/* ?@(a & |)))
80 > =a (mo `(list {@t @u})`[['a' 1] ['b' 2] ['c' 3] ['d' 4] ['e' 5] ~])
81 > (~(any by a) |=(a=@ (lte a 4)))
84------------------------------------------------------------------------
90 +- del :: delete at key b
103 ?: (vor p.n.l.a p.n.r.a)
104 [n.l.a l.l.a $(l.a r.l.a)]
105 [n.r.a $(r.a l.r.a) r.r.a]
108Produces map `a` with the element located at key `b` removed.
112`b` is a key as a noun.
114 > =b (mo `(list {@t *})`[['a' 1] ['b' [2 3]] ~])
118------------------------------------------------------------------------
124 +- dig :: axis of b key
129 ?: =(b p.n.a) [~ u=(peg c 2)]
131 $(a l.a, c (peg c 6))
132 $(a r.a, c (peg c 7))
136Produce the axis of key `b` within map `a`.
140`b` is a key as a noun.
142 > =b (mo `(list {@t *})`[['a' 1] ['b' [2 3]] ~])
146------------------------------------------------------------------------
152 +- gas :: concatenate
154 |= b/(list _?>(?=(^ a) n.a))
158 $(b t.b, a (put i.b))
162Insert a list of key-value pairs `b` into map `a`.
166`b` is a list of cells of key-value nouns `p` and `q`.
168 > =a (mo `(list {@t *})`[[`a` 1] [`b` 2] ~])
169 > =b `(list {@t *})`[[`c` 3] [`d` 4] ~]
171 {[p=`d` q=4] [p=`a` q=1] [p=`c` q=3] [p=`b` q=2]}
173------------------------------------------------------------------------
179 +- get :: unit value by key
182 |- ^- ?(~ [~ u=_?>(?=(^ a) q.n.a)])
191Produce the unit value of the value located at key `b` within map `a`.
195`b` is a key as a noun
197 > =b (mo `(list {@t *})`[['a' 1] ['b' [2 3]] ~])
201------------------------------------------------------------------------
211Produce the value located at key `b` within map `a`. Crash if key `b`
218 > =m (mo `(list {@t *})`[['a' 1] ['b' 2] ~])
220 {[p='a' q=1] [p='b' q=2]}
228------------------------------------------------------------------------
234 +- has :: key existence check
240Checks whether map `a` contains an element with key `b`, producing a
245`b` is a key as a noun.
247 > =b (mo `(list {@t *})`[['a' 1] ['b' [2 3]] ~])
253------------------------------------------------------------------------
259 +- int :: intersection
269 [n.b $(a l.a, b l.b) $(a r.a, b r.b)]
271 %- uni(a $(a l.a, b [n.b l.b ~])) $(b r.b)
272 %- uni(a $(a r.a, b [n.b ~ r.b])) $(b l.b)
274 [n.b $(b l.b, a l.a) $(b r.b, a r.a)]
276 %- uni(a $(b l.b, a [n.a l.a ~])) $(a r.a)
277 %- uni(a $(b r.b, a [n.a ~ r.a])) $(a l.a)
280Produces a map of the (key) intersection between two maps of the same
281type, `a` and `b`. If both maps have an identical key that point to
282different values, the element from map `b` is used.
288 > =n (mo `(list {@t *})`[['a' 1] ['c' 3] ~])
290 {[p='a' q=1] [p='c' q=3]}
292 {[p='a' q=1] [p='b' q=2]}
295 ~ravpel-holber/try=> =p (mo `(list {@t *})`[['a' 2] ['b' 2] ~])
297 {[p='a' q=2] [p='b' q=2]}
300 > =q (mo `(list {@t *})`[['a' 2] ['c' 2] ~])
302 {[p='a' q=2] [p='b' q=2]}
304 {[p='a' q=2] [p='b' q=2]}
305 > =o (mo `(list {@t *})`[['c' 3] ['d' 4] ~])
310------------------------------------------------------------------------
316 +- mar :: add with validation
317 |* [b=_?>(?=(^ a) p.n.a) c=(unit ,_?>(?=(^ a) q.n.a))]
322Produces map `a` with the addition of a key-value pair, where the value
325Accept a noun and a unit of a noun of the type of the map's keys and
326values, respectively. Validate that the value is not null and put the
327pair in the map. If the value is null, delete the key.
329XX This arm is broken, asana task 15186618346453
332 {[p='a' q=1] [p='b' q=2]}
333 > (~(mar by m) 'c' (some 3))
337 > (~(mar by m) 'c' ~)
341 > (~(mar by m) 'b' ~)
346------------------------------------------------------------------------
352 +- put :: adds key-value pair
367 [n.d l.d [n.a r.d r.a]]
372 [n.d [n.a l.a l.d] r.d]
375Produces `a` with the addition of the key-value pair of `b` and `c`.
379`b` is a key of the same type as the keys in `a`.
381`c` is a value of the same type of the values in `a`.
384 {[p='a' q=1] [p='b' q=2]}
385 > (~(put by m) 'c' 3)
386 {[p='a' q=1] [p='c' q=3] [p='b' q=2]}
387 > (~(put by m) "zod" 26)
390 > (~(put by m) 'a' 2)
391 {[p='a' q=2] [p='b' q=2]}
393------------------------------------------------------------------------
397 +- rep :: replace by product
401 $(a r.a, +<+.b $(a l.a, +<+.b (b n.a +<+.b)))
404Accumulate using gate from values in map
406XX interface changing.
408------------------------------------------------------------------------
412 +- rib :: transform + product
423Replace values with accumulator
425XX interface changing, possibly disappearing
427------------------------------------------------------------------------
433 +- run :: apply gate to values
437 [n=[p=p.n.a q=(b q.n.a)] l=$(a l.a) r=$(a r.a)]
439Iterates over every value in set `a` using gate `b`. Produces a map.
446 {[p='a' q=1] [p='b' q=2]}
447 > ^+(m (~(run by m) dec))
448 {[p='a' q=0] [p='b' q=1]}
449 > `(map @tas @t)`(~(run by m) (cury scot %ux))
450 {[p=%a q='0x1'] [p=%b q='0x2']}
452------------------------------------------------------------------------
458 +- tap :: listify pairs
460 |= b/(list _?>(?=(^ a) n.a))
464 $(a r.a, b [n.a $(a l.a)])
467Produces the list of all elements in map `a` that is prepended to list
468`b`, which is empty by default.
474 {[p='a' q=1] [p='b' q=2]}
476 [[98 2] [[97 1] 0 0] 0]
478 ~[[p='b' q=2] [p='a' q=1]]
482------------------------------------------------------------------------
488 +- uni :: union, merge
498 [n.b $(a l.a, b l.b) $(a r.a, b r.b)]
500 $(a [n.a $(a l.a, b [n.b l.b ~]) r.a], b r.b)
501 $(a [n.a l.a $(a r.a, b [n.b ~ r.b])], b l.b)
503 [n.b $(b l.b, a l.a) $(b r.b, a r.a)]
505 $(b [n.b $(b l.b, a [n.a l.a ~]) r.b], a r.a)
506 $(b [n.b l.b $(b r.b, a [n.a ~ r.a])], a l.a)
508Produces a map of the union between the keys of `a` and `b`. If `b`
509shares a key with `a`, the tuple from `a` is preserved.
516 {[p='a' q=1] [p='b' q=2]}
518 {[p='d' q=4] [p='c' q=3]}
520 {[p='d' q=4] [p='a' q=1] [p='c' q=3] [p='b' q=2]}
522 {[p='a' q=1] [p='b' q=2]}
524 {[p='a' q=1] [p='c' q=9]}
526 {[p='d' q=4] [p='a' q=1] [p='c' q=3]}
527 > =n (mo `(list ,[@t *])`[['a' 1] ['c' 9] ~])
529 {[p='a' q=1] [p='c' q=9]}
531 {[p='d' q=4] [p='a' q=1] [p='c' q=9]}
533------------------------------------------------------------------------
539 +- urn :: apply gate to nodes
543 [n=[p=p.n.a q=(b p.n.a q.n.a)] l=$(a l.a) r=$(a r.a)]
545Iterates over every value in map `a` using gate `b`, which accepts both
546the key and the value of each element as its sample.
550`b` is a wet gate that accepts two nouns (a key and a value) and
551produces a noun (the new value).
554 {[p='a' q=1] [p='b' q=2]}
555 > (~(urn by m) |=(a=[p=* q=*] q.a))
556 {[p='a' q=1] [p='b' q=2]}
557 > (~(urn by m) |=(a=[p=* q=*] 7))
558 {[p='a' q=7] [p='b' q=7]}
559 > (~(urn by m) |=(a=[p=* q=*] p.a))
560 {[p='a' q=97] [p='b' q=98]}
562------------------------------------------------------------------------
568 +- wyt :: depth of map
570 ?~(a 0 +((add $(a l.a) $(a r.a))))
572Produce the depth of the tree map `a`.
577 {[p='a' q=1] [p='b' q=2]}
579 {[p='d' q=4] [p='c' q=3]}
584 > ~(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