A.ord
You're seeing just the macro
ord
, go back to A module for more information.
Convenience macro to create or pattern match on A.OrdMap
s.
Use import A
to use it, or import A, only: [ord: 1]
.
Creation examples
iex> ord(%{"一" => 1, "二" => 2, "三" => 3})
ord(%{"一" => 1, "二" => 2, "三" => 3})
iex> ord(%{a: "Ant", b: "Bat", c: "Cat"})
ord(%{a: "Ant", b: "Bat", c: "Cat"})
Pattern matching examples
iex> ord(%{b: bat}) = ord(%{a: "Ant", b: "Bat", c: "Cat"}); bat
"Bat"
Replace existing keys examples
iex> ordered = ord(%{a: "Ant", b: "Bat", c: "Cat"})
iex> ord(%{ordered | b: "Buffalo"})
ord(%{a: "Ant", b: "Buffalo", c: "Cat"})
iex> ord(%{ordered | z: "Zebra"})
** (KeyError) key :z not found in: ord(%{a: "Ant", b: "Bat", c: "Cat"})