11Core whose arms contain a variety of functions that operate on `set`s. Its
12sample accepts the input `set` to be manipulated.
30 <13.evb [nlr(^$1{@tD $1}) <414.fvk 101.jzo 1.ypj %164>]>
37Computes the logical AND on every element in `a` slammed with `b`, producing a
44`b` is a wet gate that accepts a noun and produces a flag.
59 ?&((b n.a) $(a l.a) $(a r.a))
65 > =b (sy `(list [@t *])`[['a' 1] ['b' [2 3]] ~])
66 > (~(all in b) |=(a=* ?@(+.a & |)))
69 > =b (sy `(list @t)`['john' 'bonita' 'daniel' 'madeleine' ~])
70 > (~(all in b) |=(a=@t (gte a 100)))
79Computes the logical OR on every element of `a` slammed with `b`, producing a
86`b` is a gate that accepts a noun and produces a flag.
101 ?|((b n.a) $(a l.a) $(a r.a))
107 > =b (sy `(list [@t *])`[['a' 1] ['b' [2 3]] ~])
108 > (~(any in b) |=(a/* ?@(+.a & |)))
111 > =b (sy `(list @t)`['john' 'bonita' 'daniel' 'madeleine' ~])
112 > (~(any in b) |=(a=@t (lte a 100)))
121Computes whether `a` has a correct horizontal order and a correct vertical
122order, producing a flag.
136 =| [l=(unit) r=(unit)]
139 ?& ?~(l & (hor n.a u.l))
140 ?~(r & (hor u.r n.a))
141 ?~(l.a & ?&((vor n.a n.l.a) $(a l.a, l `n.a)))
142 ?~(r.a & ?&((vor n.a n.r.a) $(a r.a, r `n.a)))
152 > =a (sy [1 2 3 4 5 6 ~])
154 [n=6 l={5 4} r={1 3 2}]
160 [n=7 l={5 4} r={1 3 2}]
167See section [`2f`](@/docs/reference/library/2f.md) for more information on noun ordering.
174Splits set `a` into two sets `l` and `r`, with any noun `b` removed.
202 [n.c l.c [n.a r.c r.a]]
205 [n.c [n.a l.a l.c] r.c]
211 > =a (sy `(list @)`[1 2 3 4 5 6 ~])
213 [n=6 l={5 4} r={1 3 2}]
216 [l=[n=4 l=[n=5 l={} r={}] r=~] r=[n=2 l=[n=1 l={} r={3}] r=~]]
219 [l=[n=6 l=[n=4 l={5} r={}] r=[n=2 l={1 3} r={}]] r=~]
227Removes `b` from the `set` `a`.
256 [n.l.a l.l.a $(l.a r.l.a)]
257 [n.r.a $(r.a l.r.a) r.r.a]
264 > =b (sy `(list @t)`['a' 'b' 'c' ~])
266 [n='b' l=[n='c' l={} r={}] r=~]
268 > =b (sy `(list @t)`['john' 'bonita' 'daniel' 'madeleine' ~])
269 > (~(del in b) 'john')
270 [n='madeleine' l=[n='daniel' l={} r={'bonita'}] r=~]
272 > (~(del in b) 'susan')
273 [n='madeleine' l=[n='daniel' l={} r={'bonita'}] r=[n='john' l={} r={}]]
281Computes the difference between `a` and `b`, producing the set of items in `a`
325 > `(set @ud)`(~(dif in c) d)
328 > `(set @ud)`(~(dif in d) c)
337Produce the tree address of `b` within `a`.
347The `unit` of an atom.
357 ?: =(b n.a) [~ u=(peg c 2)]
359 $(a l.a, c (peg c 6))
360 $(a r.a, c (peg c 7))
367 > =a (sy `(list @)`[1 2 3 4 5 6 7 ~])
386For more on the tree addressing system, see section [1b](@/docs/reference/library/1b.md).
393Insert the elements of a `list` `b` into a `set` `a`.
410 |= b=(list _?>(?=(^ a) n.a))
414 $(b t.b, a (put i.b))
420 > =b `(set @t)`(sy `(list @t)`['bonita' 'madeleine' 'rudolf' 'john' ~])
422 {'bonita' 'madeleine' 'rudolf' 'john'}
424 > (~(gas in b) `(list @t)`['14' 'things' 'number' '1.337' ~])
425 [n='number' l={'1.337' '14'} r={'things' 'bonita' 'madeleine' 'rudolf' 'john'}]
427 > =s (sy `(list @t)`['a' 'b' 'c' 'd' 'e' ~])
428 > (~(gas in s) `(list @t)`['1' '2' '3' ~])
429 [n='e' l=[n='1' l={} r={'3' '2'}] r=[n='b' l={'d' 'a' 'c'} r={}]]
437Checks if `b` is an element of `a`, producing a flag.
468 > =a (~(gas in `(set @t)`~) `(list @t)`['a' 'b' 'c' ~])
481Produces a set of the intersection between two sets of the same type,
508 [n.a $(a l.a, b l.b) $(a r.a, b r.b)]
510 %- uni(a $(a l.a, b [n.b l.b ~])) $(b r.b)
511 %- uni(a $(a r.a, b [n.b ~ r.b])) $(b l.b)
518 > (~(int in `(set @t)`(sy "acmo")) `(set @t)`(sy "ham"))
521 > (~(int in (sy "acmo")) ~)
524 > (~(int in `(set @t)`(sy "ac")) `(set @t)`(sy "ha"))
533Add an element `b` to the set `a`, producing a set.
561 [n.c l.c [n.a r.c r.a]]
566 [n.c [n.a l.a l.c] r.c]
572 > =a (~(gas in `(set @t)`~) `(list @t)`['a' 'b' 'c' ~])
573 > =b (~(put in a) 'd')
586Accumulate the elements of `a` using a gate `b`.
601 +- rep :: replace by product
605 $(a r.a, +<+.b $(a l.a, +<+.b (b n.a +<+.b)))
611 > =a (~(gas in *(set @)) [1 2 3 ~])
615 > (~(rep in a) |=([a=@ b=@] (add a b)))
624Produce a `set` containing the products of gate `b` applied to each element
643 =| c=(set _?>(?=(^ a) (b n.a)))
645 =. c (~(put in c) (b n.a))
653 > =s (sy ~["a" "A" "b" "c"])
666Flattens the `set` `a` into a `list`.
681 |= b=(list _?>(?=(^ a) n.a))
685 $(a r.a b [n.a $(a l.a)])
692 > =s (sy `(list @t)`['a' 'b' 'c' 'd' 'e' ~])
694 [n='e' l={} r={'d' 'a' 'c' 'b'}]
697 ~['b' 'c' 'a' 'd' 'e']
705Produces a set of the union between two sets of the same type, `a` and
732 [n.b $(a l.a, b l.b) $(a r.a, b r.b)]
734 $(a [n.a $(a l.a, b [n.b l.b ~]) r.a], b r.b)
735 $(a [n.a l.a $(a r.a, b [n.b ~ r.b])], b l.b)
737 [n.b $(b l.b, a l.a) $(b r.b, a r.a)]
739 $(b [n.b $(b l.b, a [n.a l.a ~]) r.b], a r.a)
740 $(b [n.b l.b $(b r.b, a [n.a ~ r.a])], a l.a)
748 > (~(uni in `(set @t)`(sy "ac")) `(set @)`(sy "ha"))
749 [n='c' l={'a'} r={'h'}]
751 > (~(uni in `(set @t)`(sy "acmo")) ~)
752 [n='c' l={'a'} r={'m' 'o'}]
754 > (~(uni in `(set @t)`(sy "acmo")) `(set @t)`(sy "ham"))
755 [n='c' l={'a'} r={'m' 'o' 'h'}]
757 > (~(uni in `(set @t)`(sy "acmo")) `(set @t)`(sy "lep"))
758 [n='e' l={} r={'a' 'c' 'm' 'l' 'o' 'p'}]
766Produces the number of elements in set `a` as an atom.
779 +- wyt :: size of set
781 ?~(a 0 +((add $(a l.a) $(a r.a))))
789 > =a (~(put in (~(put in (sy)) 'a')) 'b')
793 > =b (sy `(list @t)`['john' 'bonita' 'daniel' 'madeleine' ~])
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