vyrn

Collections and Map

Arrays and maps are subject-first: the value comes before the verb. A lookup answers Option, so a missing entry is a case you handle.

Arrays

An array grows with push, is read with xs[i], and reports xs.length. An element store writes in place, and the index is checked.

pop() answers Option<T>, because an empty array has nothing to give. std/arrays adds map, filter, fold, any, all and sortBy.

length 3 total 19 popped 4

Map

Map<String, V> keeps insertion order. m[k] answers Option<V>, m[k] = v inserts or updates, and an update keeps the key where it was.

On the wire a map is a JSON object, and its schema is additionalProperties. A validated value type re-runs its rule on every insert.

keys ada, grace ada 6 hopper none length 2