defining, assigning, and accessing data
Core language statements for creating bindings, mutating values, and declaring kinds/enums.
Overview
The core statement forms are:
Variable define (
:=) to create a binding.Variable assign (
=) to update an existing mutable binding.Operator-assign (
+=,-=,*=,/=) for in-place arithmetic updates.Tuple destructure (
(a,b,...) := expr) to unpack tuple values.Enum define (
) to declare tagged variants.:= ... Kind define (
) to declare named kinds.:=
Variable define (:=)
Use ~ to define a mutable binding:
Variable assign (=)
Assignment updates an existing mutable symbol:
Assignment also supports indexed/sliced targets:
Operator-assign
In-place arithmetic statement forms:
Currently implemented operators are +=, -=, *=, /= in interpreter statement execution.
The grammar includes ^= (exp-assign-operator), but interpreter statement dispatch currently only implements add/sub/mul/div branches.
Tuple destructuring
Unpack tuple elements into new bindings:
Enum define ( := variants)
Declare enum variants using atom-style names, optionally with payload kinds.
Payload style variants are also valid:
Kind define ( := )
Declare a named kind alias/specification:
Accessing values
Core access patterns include:
Identifier access:
xIndex/slice access:
m[1,2],xs[2]Field/column access:
record.field,table.column
For detailed indexing behavior, see indexing.
Notes
Use
:=to declare and=to update.Assigning to undefined or immutable symbols is an error.
Mutation requires bindings declared with
~.