Skip to content

map

The map Library is part of the Standard Library, so every Group holds it. A Script imports the names it uses, as in use merge from map. Its normative source is spec/stdlib/map.talk, and the full rules are in chapter 7.

An argument of the wrong kind raises wrong kind before any work is done, so the entries below list only the other errors each raises (every stdlib function).

merge(a, b)

The map with the entries of a and then of b, where b’s value wins for a key in both.

without(m, keys)

m without the entries whose keys are in the list keys.

pick(m, keys)

m with only the entries whose keys are in the list keys, in m’s order.

entries(m)

The list of pairs [key, value] of m, in order.

fromEntries(pairs)

The map with the entries of the list of pairs pairs, where a later pair wins for a repeated key.

mapValues(m, f)

m with each value replaced by what f gives for it, keys and order kept.

lookup(m, path, default = nothing)

The value the Path or Value Path path locates inside m, or default if a key or position along it is missing or holds Nothing.

withPath(m, path, v)

m with v at the Path or Value Path path.

withoutPath(m, path)

m with the key or item at the Path or Value Path path removed.

hasPath(m, path)

Whether the Path or Value Path path locates a value inside m that isn’t Nothing.

transform(value, mapping)

A complete fresh mapped value, or ordered diagnostics without partial output.

Also raises: invalid mapping.