14Core whose arms contain a variety of functions that operate on `set`s. Its
15sample accepts the input `set` to be manipulated.
33 <13.evb [nlr(^$1{@tD $1}) <414.fvk 101.jzo 1.ypj %164>]>
40Computes the logical AND on every element in `a` slammed with `b`, producing a
47`b` is a wet gate that accepts a noun and produces a flag.
62 ?&((b n.a) $(a l.a) $(a r.a))
68 > =b (sy `(list [@t *])`[['a' 1] ['b' [2 3]] ~])
69 > (~(all in b) |=(a=* ?@(+.a & |)))
72 > =b (sy `(list @t)`['john' 'bonita' 'daniel' 'madeleine' ~])
73 > (~(all in b) |=(a=@t (gte a 100)))
82Computes the logical OR on every element of `a` slammed with `b`, producing a
89`b` is a gate that accepts a noun and produces a flag.
104 ?|((b n.a) $(a l.a) $(a r.a))
110 > =b (sy `(list [@t *])`[['a' 1] ['b' [2 3]] ~])
111 > (~(any in b) |=(a/* ?@(+.a & |)))
114 > =b (sy `(list @t)`['john' 'bonita' 'daniel' 'madeleine' ~])
115 > (~(any in b) |=(a=@t (lte a 100)))
124Computes whether `a` has a correct horizontal order and a correct vertical
125order, producing a flag.
139 =| [l=(unit) r=(unit)]
142 ?& ?~(l & (hor n.a u.l))
143 ?~(r & (hor u.r n.a))
144 ?~(l.a & ?&((vor n.a n.l.a) $(a l.a, l `n.a)))
145 ?~(r.a & ?&((vor n.a n.r.a) $(a r.a, r `n.a)))
155 > =a (sy [1 2 3 4 5 6 ~])
157 [n=6 l={5 4} r={1 3 2}]
163 [n=7 l={5 4} r={1 3 2}]
170See section [`2f`](../2f) for more information on noun ordering.
177Splits set `a` into two sets `l` and `r`, with any noun `b` removed.
205 [n.c l.c [n.a r.c r.a]]
208 [n.c [n.a l.a l.c] r.c]
214 > =a (sy `(list @)`[1 2 3 4 5 6 ~])
216 [n=6 l={5 4} r={1 3 2}]
219 [l=[n=4 l=[n=5 l={} r={}] r=~] r=[n=2 l=[n=1 l={} r={3}] r=~]]
222 [l=[n=6 l=[n=4 l={5} r={}] r=[n=2 l={1 3} r={}]] r=~]
230Removes `b` from the `set` `a`.
259 [n.l.a l.l.a $(l.a r.l.a)]
260 [n.r.a $(r.a l.r.a) r.r.a]
267 > =b (sy `(list @t)`['a' 'b' 'c' ~])
269 [n='b' l=[n='c' l={} r={}] r=~]
271 > =b (sy `(list @t)`['john' 'bonita' 'daniel' 'madeleine' ~])
272 > (~(del in b) 'john')
273 [n='madeleine' l=[n='daniel' l={} r={'bonita'}] r=~]
275 > (~(del in b) 'susan')
276 [n='madeleine' l=[n='daniel' l={} r={'bonita'}] r=[n='john' l={} r={}]]
284Computes the difference between `a` and `b`, producing the set of items in `a`
328 > `(set @ud)`(~(dif in c) d)
331 > `(set @ud)`(~(dif in d) c)
340Produce the tree address of `b` within `a`.
350The `unit` of an atom.
360 ?: =(b n.a) [~ u=(peg c 2)]
362 $(a l.a, c (peg c 6))
363 $(a r.a, c (peg c 7))
370 > =a (sy `(list @)`[1 2 3 4 5 6 7 ~])
389For more on the tree addressing system, see section [1b](../1b).
396Insert the elements of a `list` `b` into a `set` `a`.
413 |= b=(list _?>(?=(^ a) n.a))
417 $(b t.b, a (put i.b))
423 > =b `(set @t)`(sy `(list @t)`['bonita' 'madeleine' 'rudolf' 'john' ~])
425 {'bonita' 'madeleine' 'rudolf' 'john'}
427 > (~(gas in b) `(list @t)`['14' 'things' 'number' '1.337' ~])
428 [n='number' l={'1.337' '14'} r={'things' 'bonita' 'madeleine' 'rudolf' 'john'}]
430 > =s (sy `(list @t)`['a' 'b' 'c' 'd' 'e' ~])
431 > (~(gas in s) `(list @t)`['1' '2' '3' ~])
432 [n='e' l=[n='1' l={} r={'3' '2'}] r=[n='b' l={'d' 'a' 'c'} r={}]]
440Checks if `b` is an element of `a`, producing a flag.
471 > =a (~(gas in `(set @t)`~) `(list @t)`['a' 'b' 'c' ~])
484Produces a set of the intersection between two sets of the same type,
511 [n.a $(a l.a, b l.b) $(a r.a, b r.b)]
513 %- uni(a $(a l.a, b [n.b l.b ~])) $(b r.b)
514 %- uni(a $(a r.a, b [n.b ~ r.b])) $(b l.b)
521 > (~(int in `(set @t)`(sy "acmo")) `(set @t)`(sy "ham"))
524 > (~(int in (sy "acmo")) ~)
527 > (~(int in `(set @t)`(sy "ac")) `(set @t)`(sy "ha"))
536Add an element `b` to the set `a`, producing a set.
564 [n.c l.c [n.a r.c r.a]]
569 [n.c [n.a l.a l.c] r.c]
575 > =a (~(gas in `(set @t)`~) `(list @t)`['a' 'b' 'c' ~])
576 > =b (~(put in a) 'd')
589Accumulate the elements of `a` using a gate `b`.
604 +- rep :: replace by product
608 $(a r.a, +<+.b $(a l.a, +<+.b (b n.a +<+.b)))
614 > =a (~(gas in *(set @)) [1 2 3 ~])
618 > (~(rep in a) |=([a=@ b=@] (add a b)))
627Produce a `set` containing the products of gate `b` applied to each element
646 =| c=(set _?>(?=(^ a) (b n.a)))
648 =. c (~(put in c) (b n.a))
656 > =s (sy ~["a" "A" "b" "c"])
669Flattens the `set` `a` into a `list`.
684 |= b=(list _?>(?=(^ a) n.a))
688 $(a r.a b [n.a $(a l.a)])
695 > =s (sy `(list @t)`['a' 'b' 'c' 'd' 'e' ~])
697 [n='e' l={} r={'d' 'a' 'c' 'b'}]
700 ~['b' 'c' 'a' 'd' 'e']
708Produces a set of the union between two sets of the same type, `a` and
735 [n.b $(a l.a, b l.b) $(a r.a, b r.b)]
737 $(a [n.a $(a l.a, b [n.b l.b ~]) r.a], b r.b)
738 $(a [n.a l.a $(a r.a, b [n.b ~ r.b])], b l.b)
740 [n.b $(b l.b, a l.a) $(b r.b, a r.a)]
742 $(b [n.b $(b l.b, a [n.a l.a ~]) r.b], a r.a)
743 $(b [n.b l.b $(b r.b, a [n.a ~ r.a])], a l.a)
751 > (~(uni in `(set @t)`(sy "ac")) `(set @)`(sy "ha"))
752 [n='c' l={'a'} r={'h'}]
754 > (~(uni in `(set @t)`(sy "acmo")) ~)
755 [n='c' l={'a'} r={'m' 'o'}]
757 > (~(uni in `(set @t)`(sy "acmo")) `(set @t)`(sy "ham"))
758 [n='c' l={'a'} r={'m' 'o' 'h'}]
760 > (~(uni in `(set @t)`(sy "acmo")) `(set @t)`(sy "lep"))
761 [n='e' l={} r={'a' 'c' 'm' 'l' 'o' 'p'}]
769Produces the number of elements in set `a` as an atom.
782 +- wyt :: size of set
784 ?~(a 0 +((add $(a l.a) $(a r.a))))
792 > =a (~(put in (~(put in (sy)) 'a')) 'b')
796 > =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