Lattice ships with over 150 built-in functions and type methods organized into categories.
All built-ins are available without imports. For complete function signatures and detailed
usage, see the full API documentation.
Core Functions
Core functions provide essential operations: output, type introspection, assertions, and
value conversion.
Function
Description
print(...args)
Output values to stdout
typeof(value)
Return the type name as a string
phase_of(value)
Return the phase tag as a string
assert(condition, msg?)
Abort if condition is false
error(value)
Create an error result map ({"tag": "err", "value": ...})
is_error(value)
Check if value is an error result
require(path)
Load a module at runtime
sleep(ms)
Pause execution for milliseconds
time()
Current Unix timestamp in seconds
len(value)
Return length of string, array, map, or set
input(prompt)
Read a line from stdin
version()
Return Lattice version string
Phase Transition Functions
Function
Description
freeze(value)
Transition to crystal phase
thaw(value)
Transition to fluid phase
clone(value)
Deep copy a value
anneal(value) |v| { ... }
Thaw, transform, re-freeze
sublimate(value)
Shallow freeze (structure locked, elements mutable)
crystallize(value) { ... }
Deep freeze with scoped contracts (tree-walk only)
Note
Phase transition functions (freeze, thaw, clone,
anneal, sublimate, crystallize) and phase operators
(bond, react, seed) are language constructs compiled
to dedicated bytecode opcodes — they are not runtime native functions.
Phase System Builtins
Function
Description
track(value)
Enable temporal tracking on a value
phases(value)
Get phase transition history
rewind(value)
Revert to previous phase state
seed(value, fn)
Register a deferred crystallization contract
unseed(value)
Remove seed contract
grow(value)
Evaluate seed contracts on a value
bond(a, b, strategy)
Link two values with a phase strategy ("mirror", "inverse", "gate")
unbond(a, b)
Remove phase bond
react(value, fn)
Register a callback for phase changes: |phase, value|