millionchart
فارسی

Maps reference

The 11 functions and 0 values of map: signature, effects, phase, cost and tested examples.

A map holds values under keys. Many functions here are written as methods: m.set(k, v) is map.set(m, k, v).

Functions#

map.at#

map.at([map], [key])

The value under a key.

  • Effects: none: the result depends on the arguments only.
  • Phase: every bar.
  • Cost: a fixed number of operations.
  • Examples: Volume by weekday.

map.clear#

map.clear([map])

Removes every entry.

  • Effects: changes a collection in place.
  • Phase: every bar.
  • Cost: a fixed number of operations.

map.contains#

map.contains([map], [key])

True when the key is in the map.

  • Effects: none: the result depends on the arguments only.
  • Phase: every bar.
  • Cost: a fixed number of operations.

map.copy#

map.copy([map])

A copy of the map.

  • Effects: builds a new value whose size follows its arguments (counted in the memory ledger).
  • Phase: every bar.
  • Cost: allocates: the memory ledger counts what it builds.

map.keys#

map.keys([map])

The keys or the values as an array.

  • Effects: builds a new value whose size follows its arguments (counted in the memory ledger).
  • Phase: every bar.
  • Cost: allocates: the memory ledger counts what it builds.
  • Examples: Volume by weekday.

map.new#

map.new()

Makes an empty map.

  • Effects: builds a new value whose size follows its arguments (counted in the memory ledger).
  • Phase: every bar.
  • Cost: allocates: the memory ledger counts what it builds.

map.remove#

map.remove([map], [key])

Removes the key.

  • Effects: changes a collection in place.
  • Phase: every bar.
  • Cost: a fixed number of operations.

map.set#

map.set([map], [key], [value])

Sets the value under a key.

  • Effects: changes a collection in place; builds a new value whose size follows its arguments (counted in the memory ledger).
  • Phase: every bar.
  • Cost: allocates: the memory ledger counts what it builds.
  • Examples: Volume by weekday.

map.set_all#

map.set_all([map], [other])

Copies every entry of another map into the map.

  • Effects: changes a collection in place; builds a new value whose size follows its arguments (counted in the memory ledger).
  • Phase: every bar.
  • Cost: allocates: the memory ledger counts what it builds.

map.size#

map.size([map])

The number of entries.

  • Effects: none: the result depends on the arguments only.
  • Phase: every bar.
  • Cost: a fixed number of operations.
  • Examples: Volume by weekday.

map.values#

map.values([map])

The keys or the values as an array.

  • Effects: builds a new value whose size follows its arguments (counted in the memory ledger).
  • Phase: every bar.
  • Cost: allocates: the memory ledger counts what it builds.