general

meth :WeakMapT()

TBD

fun assign(Var: any, Value: any): any

Functional equivalent of Var := Value.

fun call(Fn: any, Arg₁: any, ..., Argₙ: any): any

Returns Fn(Arg₁, ..., Argₙ).

fun cas(Var: any, Old: any, New: any): any

If the value of Var is identically equal to Old, then sets Var to New and returns New. Otherwise leaves Var unchanged and returns nil.

var X := 10
cas(X, 10, 11) :> 11
X :> 11
cas(X, 20, 21) :> nil
X :> 11
fun copy(Value: any, Fn?: function): any

Returns a copy of Value using a new copy instance which applies Fn(Copy, Value) to each value. If omitted, Fn defaults to :copy.

fun deref(Value: any): any

Returns the dereferenced value of Value.

fun exchange(Var₁: any, ..., Varₙ: any)

Assigns Varᵢ := Varᵢ₊₁ for each 1 <= i < n and Varₙ := Var₁.

fun findall(Value: any, Filter?: boolean|type): list

Returns a list of all unique values referenced by Value (including Value).

fun isconstant(Value: any): any | nil

Returns some if it is a constant (i.e. directly immutable and not referencing any mutable values), otherwise returns nil.

isconstant(1) :> 1
isconstant(1.5) :> 1.5
isconstant("Hello") :> "Hello"
isconstant(true) :> true
isconstant([1, 2, 3]) :> nil
isconstant((1, 2, 3)) :> (1, 2, 3)
isconstant((1, [2], 3)) :> nil
fun replace(Var₁: any, ..., Varₙ: any, Value: any)

Assigns Varᵢ := Varᵢ₊₁ for each 1 <= i < n and Varₙ := Value. Returns the old value of Var₁.

fun visit(Value: any, Fn: function): any

Returns Fn(V, Value) where V is a newly created visitor.

type visitor < function

Used to apply a transformation recursively to values.

fun (V: visitor)(Value: any, Result: any): any

Adds the pair (Value, Result) to V's cache and returns Result.

fun (V: visitor)(Value: any): any

Visits Value with V returning the result.

meth (Visitor: visitor):const(Value: any): any

Default visitor implementation, just returns Value.

meth (Visitor: visitor):copy(Value: any): any

Default visitor implementation, just returns Value.

meth (Visitor: visitor):visit(Value: any): any

Default visitor implementation, just returns nil.

type weakmap

TBD

meth (Arg₁: weakmap):insert(Arg₂: string)

TBD

type weakmaptoken

TBD

meth (Arg₁: string::buffer):append(Arg₂: weakmaptoken)

TBD