This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| iex> Map.replace!(example_map, :delta, "five") | |
| ** (KeyError) key :delta not found in: %{alpha: "one", bravo: "two", charlie: "three"} | |
| (stdlib 3.12.1) :maps.update(:delta, "five", %{alpha: "one", bravo: "two", charlie: "three"}) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| iex> Map.update!(example_map, :charlie, fn charlie -> charlie <> " and four" end) | |
| %{alpha: "one", bravo: "two", charlie: "three and four"} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| iex> Map.update!(example_map, :delta, fn delta -> delta <> " and four" end) | |
| ** (KeyError) key :delta not found in: %{alpha: "one", bravo: "two", charlie: "three"} | |
| (stdlib 3.12.1) :maps.get(:delta, %{alpha: "one", bravo: "two", charlie: "three"}) | |
| (elixir 1.10.3) lib/map.ex:272: Map.update!/3 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| iex> Map.update(example_map, :charlie, "three", fn charlie -> charlie <> " and four" end) | |
| %{alpha: "one", bravo: "two", charlie: "three and four"} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| iex> Map.update(example_map, :delta, "four", fn delta -> delta <> " and five" end) | |
| %{alpha: "one", bravo: "two", charlie: "three", delta: "four"} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| iex> example_map |> Map.put(:alpha, "eight") |> Map.put(:bravo, "nine") | |
| %{alpha: "eight", bravo: "nine", charlie: "three"} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| iex> example_map |> Map.replace!(:alpha, "eight") |> Map.replace!(:bravo, "nine") | |
| %{alpha: "eight", bravo: "nine", charlie: "three"} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| iex> %{example_map | alpha: "eight", bravo: "nine"} | |
| %{alpha: "eight", bravo: "nine", charlie: "three"} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| [kind: :less_than_or_equal_to, number: 0, validation: :number] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| iex> Map.new([kind: :less_than_or_equal_to, number: 0, validation: :number]) | |
| %{kind: :less_than_or_equal_to, number: 0, validation: :number} |