pub enum PrimOp {
Show 27 variants
Add,
Sub,
Mul,
Div,
Lt,
Le,
EqInt,
EqText,
And,
Or,
Not,
Concat,
ToText,
FAdd,
FSub,
FMul,
FDiv,
FLt,
FLe,
EqFix,
FixOfInt,
IntOfFix,
FixToText,
Len,
FSin,
FCos,
ListCat,
}Expand description
Pure operations on the deterministic core.
Variants§
Add
Sub
Mul
Div
Total: division by zero is 0 (no traps exist in Weft).
Lt
Le
EqInt
EqText
And
Or
Not
Concat
ToText
Render an Int as Text (base 10) — total, deterministic.
FAdd
Fix + Fix → Fix (wrapping).
FSub
Fix − Fix → Fix (wrapping).
FMul
Fix × Fix → Fix — exact via 128-bit intermediate, then rescaled.
FDiv
Fix ÷ Fix → Fix — exact via 128-bit intermediate; ÷0 = 0 (total).
FLt
FLe
EqFix
FixOfInt
Int → Fix (×FIX_SCALE, wrapping).
IntOfFix
Fix → Int (truncate toward zero).
FixToText
Render a Fix as decimal Text (“1.5”, “-0.25”) — canonical: no trailing zeros, no exponent, always a leading integer digit.
Len
List length (any element type) → Int.
FSin
Fixed-point sine (radians in, Fix in/out) — Bhaskara I’s approximation computed in pure integer arithmetic: deterministic on every host, ~0.2 % max error — a world-builder’s sine, not a scientist’s.
FCos
Fixed-point cosine — FSin(x + π/2).
ListCat
Append two lists of the same element type — the composition primitive.
Weft has no recursive types, so a tree cannot be a value; a list of
uniform records can, and ListCat is what lets one program’s parts
join another’s (the modeling library is built on it). Appended after
FCos: discriminant order is the encoding, so existing hashes hold.