pub enum UnOpKind {
IsNum,
IsSym,
IsNil,
IsPair,
Car,
Cdr,
CellNew,
CellRead,
Lift,
Print,
}Expand description
Unary primitive operators that share the same shape:
- eval e1 → v1
- dispatch on v1
Run’s b-operand is also unary in this sense — once b is evaluated,
the Run arm decides between staged-run (b is Code) and run-now
(b is anything else). The e operand is held on the continuation.
Variants§
IsNum
num? — Cst → 1, Code → reflect IsNum, else 0
IsSym
sym? — Sym → 1, Code → reflect IsSym, else 0
IsNil
nil? — Nil → 1, Code → reflect IsNil, else 0
IsPair
pair? — Tup → 1, Code → reflect IsPair, else 0
Car
car — Tup → first, Code → reflect Car, else TypeError
Cdr
cdr — Tup → second, Code → reflect Cdr, else TypeError
CellNew
cell-new — any non-Code → allocate Cell, Code → reflect CellNew
CellRead
cell-read — Cell → contents, Code → reflect CellRead, else TypeError
Lift
lift — wrap as Code via the lift operator (Cst/Sym/Nil are
trivial; Clo triggers η-expansion; Tup recurses on parts;
Code lifts one stage).
print — IO side effect, returns Nil