Initial data commit

This commit is contained in:
Ingy döt Net 2023-07-01 11:58:00 -04:00
parent 72d218235f
commit f23f22d71c
199087 changed files with 3378941 additions and 0 deletions

View file

@ -0,0 +1,15 @@
empty_map = Map.new #=> %{}
kwlist = [x: 1, y: 2] # Key Word List
Map.new(kwlist) #=> %{x: 1, y: 2}
Map.new([{1,"A"}, {2,"B"}]) #=> %{1 => "A", 2 => "B"}
map = %{:a => 1, 2 => :b} #=> %{2 => :b, :a => 1}
map[:a] #=> 1
map[2] #=> :b
# If you pass duplicate keys when creating a map, the last one wins:
%{1 => 1, 1 => 2} #=> %{1 => 2}
# When all the keys in a map are atoms, you can use the keyword syntax for convenience:
map = %{:a => 1, :b => 2} #=> %{a: 1, b: 2}
map.a #=> 1
%{map | :a => 2} #=> %{a: 2, b: 2} update only