Functions - lang.map

entries

Returns a map containing [key, member] pair as the value for each key.

filter

Returns a new map constructed from those elements of 'm' for which func returns true.

forEach

Applies func to each member of m.

get

Returns the member of map m with key k. Panics if m does not have a member with key k.

hasKey

Tells whether m has a member with key k.

iterator

Returns an iterator over the members of m.

keys

Returns a list of all the keys of map m.

length

Returns number of members in m.

map

Return a map with the result of applying function func to each member of map m.

reduce

Reduce operate on each member of m using combining function func to produce a new value combining all members of m.

remove

Removes the member of m with key k and returns it. Panics if there is no such member.

removeAll

Removes all members of m. Panics if any member cannot be removed.

entries

(map m)

returns map

Returns a map containing [key, member] pair as the value for each key.

Parameters

  • m map
  • the map

  • Return Type

    (map)
  • map of [key, member] pairs

filter

(map m, function(Type) returns (boolean) func)

returns map

Returns a new map constructed from those elements of 'm' for which func returns true.

Parameters

  • m map
  • the map

  • func function(Type) returns (boolean)
  • a predicate to apply to each element to determine if it should be included

  • Return Type

    (map)
  • new map containig members which evaluate function 'func' to true

forEach

Applies func to each member of m.

Parameters

  • m map
  • the map

  • func function(Type) returns (())
  • a function to apply to each member

get

(map m, string k)

returns Type

Returns the member of map m with key k. Panics if m does not have a member with key k.

Parameters

  • m map
  • the map

  • Return Type

    (Type)
  • member matching key k

hasKey

(map m, string k)

returns boolean

Tells whether m has a member with key k.

Parameters

  • m map
  • the map

  • Return Type

    (boolean)
  • true if m has a member with key k

iterator

(map m)

returns $anonType$2

Returns an iterator over the members of m.

Parameters

  • m map
  • the map

keys

(map m)

returns string[]

Returns a list of all the keys of map m.

Parameters

  • m map
  • the map

  • Return Type

    (string[])
  • list of all keys

length

(map m)

returns int

Returns number of members in m.

Parameters

  • m map
  • the map

  • Return Type

    (int)
  • number of members in the map

map

(map m, function(Type) returns (Type1) func)

returns map

Return a map with the result of applying function func to each member of map m.

Parameters

  • m map
  • the map

  • func function(Type) returns (Type1)
  • a function to apply to each member

  • Return Type

    (map)
  • new map containing result of applying function func to each member

reduce

(map m, function(Type1, Type) returns (Type1) func, Type1 initial)

returns Type1

Reduce operate on each member of m using combining function func to produce a new value combining all members of m.

Parameters

  • m map
  • the map

  • initial Type1
  • initial value to first evaluation of combining function func

  • Return Type

    (Type1)
  • result of applying combining function to each member of the map

remove

(map m, string k)

returns Type

Removes the member of m with key k and returns it. Panics if there is no such member.

Parameters

  • m map
  • the map

  • Return Type

    (Type)
  • removed member

removeAll

Removes all members of m. Panics if any member cannot be removed.

Parameters

  • m map
  • the map