Maps

Hash maps with insertion-order iteration and a #{} literal syntax.

Summary

Map literals use #{/} to distinguish them from blocks. Keys can be strings or integers. Access uses bracket notation; setting a new key creates it. Iteration over a map yields keys in insertion order. Maps support spread with #{...m, key: val}. The .merge() method produces a new map where the right side wins on key conflicts.

Canonical

var m = #{"name": "Alice", "age": 30}

-- access
m["name"]                        -- "Alice"
m["new_key"] = 42                -- set new key

-- methods
m.keys()                         -- ["name", "age"]
m.values()                       -- ["Alice", 30]
m.entries()                      -- [("name", "Alice"), ("age", 30)]
m.len()                          -- 2
m.has("name")                    -- true
m.get("name", "default")         -- "Alice" (with fallback)
m.set("key", "val")              -- set entry, returns null
m.delete("key")                  -- remove entry
m.merge(other_map)               -- merge (right side wins on key conflict)

-- spread
let m2 = #{...m, "extra": true}

Map literals use #{}: the # distinguishes them from blocks. Keys can be strings or integers.