2n: Functional Hacks
+aftr
+aftrPair after.
+aftr first takes gate .a, producing a wet gate. The new wet gate then takes .b, producing the inverted pair of [b a]. This is the inverted version of +fore.
Accepts
.a is a gate, and the sample of +aftr.
.b is a gate, and the sample of (aftr a).
Produces
(pair b a).
Source
++ aftr |*(a=$-(* *) |*(b=$-(* *) (pair b a)))Examples
> =a (aftr @ud)
> `(a @t)`['foo' 42]
[p='foo' q=42]+cork
+corkCompose forward.
Call gate .a, then call gate .b with its product.
This is a wet gate that takes two gates and produces a new gate.
This is the inverse of +corl.
Accepts
.a is a gate.
.b is a gate.
Source
Examples
+corl
+corlCompose backward.
Call gate .b, then call gate .a with its product.
This is a wet gate that takes two gates and produces a new gate.
This is the inverse of +cork.
Accepts
.a is a gate.
.b is a gate.
Source
Examples
+curr
+currRight curry.
Right-curry a gate, binding the tail of its sample
Accepts
.a is a gate.
.c is a $noun.
Produces
A gate.
Source
Examples
+cury
+curyCurry left.
Curry a gate, binding the head of its sample.
Accepts
.a is a gate.
.b is a $noun.
Produces
A gate.
Source
Examples
+fore
+forePair before.
+fore first takes gate .a, producing a wet gate. The new wet gate then takes .b, producing the pair of [a b].
Accepts
.a is a gate, and is the sample of +fore.
.b is a gate, and is the sample of (fore a).
Produces
(pair a b).
Source
Examples
+head
+headGet head.
Produces the head of a cell.
Accepts
A cell.
Produces
A $noun.
Source
Examples
+same
+sameIdentity.
Produces the same value that it was given.
Accepts
A $noun.
Produces
A $noun.
Source
Examples
+succ
+succSuccessor.
Increment an $atom.
Accepts
An $atom.
Produces
An $atom.
Source
Examples
+tail
+tailGet tail.
Produces the tail of a cell.
Accepts
A cell.
Produces
A $noun.
Source
Examples
+test
+testTest for equality.
Checks if a and b are equal, producing a $flag.
Accepts
a is a $noun.
b is a $noun.
Produces
A $flag.
Source
Examples
+lead
+leadPut head.
(lead a) produces a wet gate, then ((lead a) b) produces [a b].
Accepts
a is a $noun, and is the sample of +lead.
b is a $noun, and is the sample of ((lead a) b)
Produces
A cell of [a b].
Source
Examples
+late
+latePut tail.
(late a) produces a wet gate, then ((late a) b) produces the inverted cell [b a]. This is the inverted version of +lead.
Accepts
a is a $noun, and is the sample of +late.
b is a $noun, and is the sample of (late a).
Produces
A cell of [b a].
Source
Examples
Last updated