2h: Set Logic
+in
+inSet operations.
Core whose arms contain a variety of functions that operate on +sets. Its sample accepts the input +set to be manipulated.
Accepts
A +set.
Source
~/ %in
=| a=(tree)
|@Examples
> ~(. in (sy "asd"))
<16.ufw [a=?(%~ [?(n=@tD n=#1) l=nlr(?(@tD #1)) r=nlr(?(@tD ^#1.?(@tD #1)))]) <123.zao 46.hgz 1.pnw %140>]>+all:in
+all:inLogical AND.
Computes the logical AND on every element in .a slammed with .b, producing a $flag.
Accepts
.a is a +set, and is the sample of +in.
.b is a gate that accepts a $noun and produces a $flag.
Produces
A $flag.
Source
Examples
+any:in
+any:inLogical OR.
Computes the logical OR on every element of .a slammed with .b, producing a $flag.
Accepts
.a is a +set, and is the sample of +in.
.b is a gate that accepts a $noun and produces a $flag.
Produces
A $flag.
Source
Examples
+apt:in
+apt:inCheck correctness.
Computes whether .a has a correct horizontal order and a correct vertical order, producing a $flag.
Accepts
.a is a +set.
Produces
A $flag.
Source
Examples
Discussion
See section 2f for more information on $noun ordering.
+bif:in
+bif:inBifurcate.
Splits set .a into sets .l and .r, which contain the items either side of .b but not including .b.
Accepts
.a is a +set, and is the sample of +in.
.b is a $noun.
Produces
A cell of two +sets.
Source
Examples
Discussion
Note that +sets are horizontally ordered by the mug hash of their items and vertically ordered by the double-+mug hash of their items. This means bifurcating the set of numbers (silt ~[10 20 30 40 50]) at 30 will not produce [{10 20} {40 50}], but rather [{20} {10 40 50}] due to the tree structure resulting from their +mug hashes.
+del:in
+del:inRemove $noun.
Removes .b from the +set .a.
Accepts
.a is a +set, and is the sample of +in.
.b is a $noun.
Produces
A +set.
Source
Examples
+dif:in
+dif:inDifference.
Computes the difference between .a and .b, producing the set of items in .a that are not in .b.
Accepts
.a is a +set, and is the sample of +in.
.b is a +set.
Produces
A +set.
Source
Examples
+dig:in
+dig:inAddress .b in .a.
Produce the tree address of .b within .a.
Accepts
.a is a +set, and is the sample of +in.
.b is a $noun.
Produces
The +unit of an $atom.
Source
Examples
Discussion
For more on the tree addressing system, see section 1b.
+gas:in
+gas:inConcatenate.
Insert the elements of a +list .b into a +set .a.
Accepts
.a is a +set, and is the sample of +in.
.b is a list.
Produces
A +set.
Source
Examples
+has:in
+has:inIs .b in .a?
Checks if .b is an element of .a, producing a $flag.
Accepts
.a is a +set, and is the sample of +in.
.b is a $noun.
Produces
A $flag.
Source
Examples
+int:in
+int:inIntersection.
Produces a +set of the intersection between two sets of the same type, .a and .b.
Accepts
.a is a +set, and is the sample of +in.
.b is a +set.
Produces
A +set.
Source
Examples
+put:in
+put:inPut .b in .a.
Add an element .b to the set .a, producing a +set.
Accepts
.a is a +set, and is the sample of +in.
.b is a $noun.
Produces
A +set.
Source
Examples
+rep:in
+rep:inAccumulate.
Accumulate the elements of .a using binary gate .b.
Accepts
.a is a +set, and is the sample of +in.
.b is a gate.
Produces
A $noun.
Source
Examples
+run:in
+run:inApply gate to set.
Produce a +set containing the products of gate .b applied to each element in .a.
Accepts
.a is a +set.
.b is a gate.
Produces
A +set.
Source
Examples
+tap:in
+tap:inSet to list.
Flattens the +set .a into a +list.
Accepts
.a is an set.
Produces
A list.
Source
Examples
+uni:in
+uni:inUnion.
Produces a +set of the union between two sets of the same type, .a and .b.
Accepts
.a is a +set, and is the sample of +in.
.b is a +set.
Produces
A +set.
Source
Examples
+wyt:in
+wyt:inSet size.
Produces the number of elements in set .a as an $atom.
Accepts
.a is a +set.
Produces
An $atom.
Source
Examples
Last updated