Runes Flashcards
.+
Increment an atom.
e.g. .+(1) produces 2
.=
Test for equality. If equal, produces %.y; otherwise %.n.
e.g. .=(1 1) produces %.y
.?
Test for cell or atom. Produces %.y if p is a cell; otherwise %.n.
?>
Positive assertion. If p = q then return %.y; otherwise force crash.
?:
Branch on a boolean test. If p produces yes, %.y, then q. If p produces no, %.n, then r.
?.
Branch on a boolean test, inverted. For when yes-case is much taller / wider than the no-case; aesthetic.
?[gal]
Negative assertion. If %.y, force crash.
?&
Boolean AND.
?=
Test type. Returns %.y or %.n.
?!
Boolean NOT
|=
Create a gate (aka a function)
e.g. |= end=@
Creates function, specifying it takes one argument, which we named “end”, and “@” specifies the input is an atom.
=/
Store a value with a name and a specified type
e.g. =/ count=@ 1
count=@ (the first child) stores 1 (the second child) as count and specifies that it has the @ type
This is as close as you’ll get to a variable
|-
Produce a trap (a core with one arm $) and evaluate it. Can be thought of as a ‘recursion point’ or a ‘loop starting point’.
^-
Use in a gate to constrain output to a certain type
e.g. ^- (list @)
Specifies that our gate’s output must be (list @) — that is, a list of atoms
:-
Create a cell.
+|
Provides a label for the arms that follow.
The arms of a core can be divided into chapters for ‘organization’. Chapter labels aren’t part of the underlying noun of the core; they’re stored as type system metadata only.
e.g. +| %math
++
Produce a normal arm.
e.g. \++ add ~/ %add :: unsigned addition :: :: a: augend :: b: addend |= [a=@ b=@] :: sum ^- @ ?: =(0 a) b $(a (dec a), b +(b))
|%
Produces a core.
–
Indicate there are no more arms to be defined.
=.
Changes the leg of the subject to something else.
=
Compose two expressions, inverted for aesthetic reasons.
=>
Compose two expressions.
=~
Compose multiple expressions.
/-
Import library from sur
/+
Import library from lib
=,
Expose a namespace.