10Core whose arms contain a variety of functions that operate on `set`s. Its
11sample accepts the input `set` to be manipulated.
29 <13.evb [nlr(^$1{@tD $1}) <414.fvk 101.jzo 1.ypj %164>]>
36Computes the logical AND on every element in `a` slammed with `b`, producing a
43`b` is a wet gate that accepts a noun and produces a flag.
58 ?&((b n.a) $(a l.a) $(a r.a))
64 > =b (sy `(list [@t *])`[['a' 1] ['b' [2 3]] ~])
65 > (~(all in b) |=(a=* ?@(+.a & |)))
68 > =b (sy `(list @t)`['john' 'bonita' 'daniel' 'madeleine' ~])
69 > (~(all in b) |=(a=@t (gte a 100)))
78Computes the logical OR on every element of `a` slammed with `b`, producing a
85`b` is a gate that accepts a noun and produces a flag.
100 ?|((b n.a) $(a l.a) $(a r.a))
106 > =b (sy `(list [@t *])`[['a' 1] ['b' [2 3]] ~])
107 > (~(any in b) |=(a/* ?@(+.a & |)))
110 > =b (sy `(list @t)`['john' 'bonita' 'daniel' 'madeleine' ~])
111 > (~(any in b) |=(a=@t (lte a 100)))
120Computes whether `a` has a correct horizontal order and a correct vertical
121order, producing a flag.
135 =| [l=(unit) r=(unit)]
138 ?& ?~(l & (hor n.a u.l))
139 ?~(r & (hor u.r n.a))
140 ?~(l.a & ?&((vor n.a n.l.a) $(a l.a, l `n.a)))
141 ?~(r.a & ?&((vor n.a n.r.a) $(a r.a, r `n.a)))
151 > =a (sy [1 2 3 4 5 6 ~])
153 [n=6 l={5 4} r={1 3 2}]
159 [n=7 l={5 4} r={1 3 2}]
166See section [`2f`](@/docs/reference/library/2f.md) for more information on noun ordering.
173Splits set `a` into two sets `l` and `r`, with any noun `b` removed.
201 [n.c l.c [n.a r.c r.a]]
204 [n.c [n.a l.a l.c] r.c]
210 > =a (sy `(list @)`[1 2 3 4 5 6 ~])
212 [n=6 l={5 4} r={1 3 2}]
215 [l=[n=4 l=[n=5 l={} r={}] r=~] r=[n=2 l=[n=1 l={} r={3}] r=~]]
218 [l=[n=6 l=[n=4 l={5} r={}] r=[n=2 l={1 3} r={}]] r=~]
226Removes `b` from the `set` `a`.
255 [n.l.a l.l.a $(l.a r.l.a)]
256 [n.r.a $(r.a l.r.a) r.r.a]
263 > =b (sy `(list @t)`['a' 'b' 'c' ~])
265 [n='b' l=[n='c' l={} r={}] r=~]
267 > =b (sy `(list @t)`['john' 'bonita' 'daniel' 'madeleine' ~])
268 > (~(del in b) 'john')
269 [n='madeleine' l=[n='daniel' l={} r={'bonita'}] r=~]
271 > (~(del in b) 'susan')
272 [n='madeleine' l=[n='daniel' l={} r={'bonita'}] r=[n='john' l={} r={}]]
280Computes the difference between `a` and `b`, producing the set of items in `a`
324 > `(set @ud)`(~(dif in c) d)
327 > `(set @ud)`(~(dif in d) c)
336Produce the tree address of `b` within `a`.
346The `unit` of an atom.
356 ?: =(b n.a) [~ u=(peg c 2)]
358 $(a l.a, c (peg c 6))
359 $(a r.a, c (peg c 7))
366 > =a (sy `(list @)`[1 2 3 4 5 6 7 ~])
385For more on the tree addressing system, see section [1b](@/docs/reference/library/1b.md).
392Insert the elements of a `list` `b` into a `set` `a`.
409 |= b=(list _?>(?=(^ a) n.a))
413 $(b t.b, a (put i.b))
419 > =b `(set @t)`(sy `(list @t)`['bonita' 'madeleine' 'rudolf' 'john' ~])
421 {'bonita' 'madeleine' 'rudolf' 'john'}
423 > (~(gas in b) `(list @t)`['14' 'things' 'number' '1.337' ~])
424 [n='number' l={'1.337' '14'} r={'things' 'bonita' 'madeleine' 'rudolf' 'john'}]
426 > =s (sy `(list @t)`['a' 'b' 'c' 'd' 'e' ~])
427 > (~(gas in s) `(list @t)`['1' '2' '3' ~])
428 [n='e' l=[n='1' l={} r={'3' '2'}] r=[n='b' l={'d' 'a' 'c'} r={}]]
436Checks if `b` is an element of `a`, producing a flag.
467 > =a (~(gas in `(set @t)`~) `(list @t)`['a' 'b' 'c' ~])
480Produces a set of the intersection between two sets of the same type,
507 [n.a $(a l.a, b l.b) $(a r.a, b r.b)]
509 %- uni(a $(a l.a, b [n.b l.b ~])) $(b r.b)
510 %- uni(a $(a r.a, b [n.b ~ r.b])) $(b l.b)
517 > (~(int in `(set @t)`(sy "acmo")) `(set @t)`(sy "ham"))
520 > (~(int in (sy "acmo")) ~)
523 > (~(int in `(set @t)`(sy "ac")) `(set @t)`(sy "ha"))
532Add an element `b` to the set `a`, producing a set.
560 [n.c l.c [n.a r.c r.a]]
565 [n.c [n.a l.a l.c] r.c]
571 > =a (~(gas in `(set @t)`~) `(list @t)`['a' 'b' 'c' ~])
572 > =b (~(put in a) 'd')
585Accumulate the elements of `a` using a gate `b`.
600 +- rep :: replace by product
604 $(a r.a, +<+.b $(a l.a, +<+.b (b n.a +<+.b)))
610 > =a (~(gas in *(set @)) [1 2 3 ~])
614 > (~(rep in a) |=([a=@ b=@] (add a b)))
623Produce a `set` containing the products of gate `b` applied to each element
642 =| c=(set _?>(?=(^ a) (b n.a)))
644 =. c (~(put in c) (b n.a))
652 > =s (sy ~["a" "A" "b" "c"])
665Flattens the `set` `a` into a `list`.
680 |= b=(list _?>(?=(^ a) n.a))
684 $(a r.a b [n.a $(a l.a)])
691 > =s (sy `(list @t)`['a' 'b' 'c' 'd' 'e' ~])
693 [n='e' l={} r={'d' 'a' 'c' 'b'}]
696 ~['b' 'c' 'a' 'd' 'e']
704Produces a set of the union between two sets of the same type, `a` and
731 [n.b $(a l.a, b l.b) $(a r.a, b r.b)]
733 $(a [n.a $(a l.a, b [n.b l.b ~]) r.a], b r.b)
734 $(a [n.a l.a $(a r.a, b [n.b ~ r.b])], b l.b)
736 [n.b $(b l.b, a l.a) $(b r.b, a r.a)]
738 $(b [n.b $(b l.b, a [n.a l.a ~]) r.b], a r.a)
739 $(b [n.b l.b $(b r.b, a [n.a ~ r.a])], a l.a)
747 > (~(uni in `(set @t)`(sy "ac")) `(set @)`(sy "ha"))
748 [n='c' l={'a'} r={'h'}]
750 > (~(uni in `(set @t)`(sy "acmo")) ~)
751 [n='c' l={'a'} r={'m' 'o'}]
753 > (~(uni in `(set @t)`(sy "acmo")) `(set @t)`(sy "ham"))
754 [n='c' l={'a'} r={'m' 'o' 'h'}]
756 > (~(uni in `(set @t)`(sy "acmo")) `(set @t)`(sy "lep"))
757 [n='e' l={} r={'a' 'c' 'm' 'l' 'o' 'p'}]
765Produces the number of elements in set `a` as an atom.
778 +- wyt :: size of set
780 ?~(a 0 +((add $(a l.a) $(a r.a))))
788 > =a (~(put in (~(put in (sy)) 'a')) 'b')
792 > =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