gossamer/map

Types

pub type Map(key, value)

Values

pub fn clear(map: Map(key, value)) -> Map(key, value)

Removes all entries. Mutates the map.

pub fn delete(from map: Map(key, value), key key: key) -> Bool

Returns whether the key existed before removal.

pub fn entries(of map: Map(key, value)) -> List(#(key, value))
pub fn for_each(
  in map: Map(key, value),
  run callback: fn(value, key) -> a,
) -> Nil
pub fn from_list(entries: List(#(key, value))) -> Map(key, value)
pub fn get(
  from map: Map(key, value),
  key key: key,
) -> Result(value, Nil)

Returns the value associated with the given key, or an error if not found.

pub fn has(in map: Map(key, value), key key: key) -> Bool
pub fn keys(of map: Map(key, value)) -> List(key)
pub fn new() -> Map(key, value)
pub fn set(
  in map: Map(key, value),
  key key: key,
  value value: value,
) -> Map(key, value)

Sets the value for the given key. Mutates the map.

pub fn size(of map: Map(key, value)) -> Int
pub fn values(of map: Map(key, value)) -> List(value)
Search Document