Map#
The e.map(x, t) macro transforms each element x in collection e using expression t, producing a new list.
Lists#
Apply a transformation to each element.
Mapping an empty list returns an empty list.
Maps#
When applied to a map type, map iterates over keys and produces a list.
// input: scores = {"alice": 95, "bob": 87}
scores.map(name,
scores[name] + 5)
// result: [100, 92] (list)
An empty map returns an empty list.
Filter and transform#
The e.map(x, p, t) form filters before transforming.
Only elements where predicate p is true are included in the result.
This is equivalent to chaining filter and map, but avoids allocating the result of the filter.