Maps and sets (roadmap #17)

var counts = {}                        # Map[Str, Int], inferred
for w in split(text, " "):
  if w in counts:
    counts[w] = counts[w] + 1          # in place: nobody else holds `counts`
  else:
    counts[w] = 1
get(counts, "cat")                     # Option[Int]: None
for w in counts: ...                   # keys, in insertion order
let s = add(set([1, 2]), 3)            # Set[Int]; union / intersection / difference
3 in s, "lo" in "hello", 2 in [1, 2]   # `in` works on Map keys, Set, List and Str

Semantics

Implementation

Evidence

Honest notes