Panics on out-of-bounds (.expect("reason")) or substitutes def
Fallible write
xs(i) = val / xs(i) = val !| _
< | Error > / ()
Updates slot i if in bounds; !| _ aborts on out-of-bounds write
Create slice view
xs(a..b) / xs(a...b) / xs(..)
T[]
Non-owning window into xs’s current buffer (a.., ..b, -k.. supported)
Shallow container copy
++xs / ++view
Same as operand
Allocates a fresh backing buffer and copies element slots
Iteration (@)
xs @ x, i => body
() (or <U|> with >--)
Captures initial len and data pointer at loop entry
#useio#typeIntsInt{}sum_slice: Int[]=>Intsum_slice = s =>acc'=0 s @ x =>acc'=acc'+ xacc'xs =Ints()xs +=10xs +=20xs +=30xs(1) =25!| _io::out $ (xs(0).expect("missing xs"), ?xs, sum_slice(xs(0..3))) // (10, 3, 65)
An index lookup returns a ramification even inside a loop over 0..?xs or after an explicit range check. Use xs @ x, i => when traversing a single collection. If an operation needs a second collection, handle its indexed result with a choice or a fallback.
Stored in 64-bit packed slots (Float, Int, Addr, or arena pointers to records/strings/containers)
12.3.2 Map operations and runtime characteristics
Operation
Syntax
Result Type
Semantics
Empty construction
m = Dict()
K ^ V
Initial capacity 8 slots
Literal construction
m = ("k1" ^= 10, "k2" ^= 20)
K ^ V
Infers K ^ V from key ^= value pairs
Insert / overwrite
m ^ k = val
()
Inserts (k, val) or overwrites existing k in place without rehashing
Fallible lookup
m ^ k
< V | Error >
Returns <+ val -> if present, else <- Error(...) +>
Membership check
m ^? k
<>
Returns <+> if k is present, <-> if absent
Delete entry
m ^- k
<>
Marks slot as tombstone (2) and returns <+> if removed, <-> if absent
Active count
?m
Int
Number of live occupied entries (excludes tombstones)
Snapshot iteration
m @ val, key => body m @ body
()
Captures snapshot of (keys, vals, states) at loop entry; concurrent m ^ k = v or m ^- k mutations never invalidate or desynchronize the active traversal. Note: binder order is value first (_), key second (_i)
Load factor & resize
Automatic at 75% occupancy
—
When (count + tombs + 1) * 4 > cap * 3: doubles capacity if count > cap / 2, otherwise rebuilds in place at same capacity to purge tombstones