2016 Update

This commit is contained in:
Tina Müller 2016-12-05 22:15:40 +01:00
parent 948b86eafa
commit dcf5d15da3
7965 changed files with 139854 additions and 31002 deletions

View file

@ -1,19 +1,17 @@
defmodule RC do
def dict_create(dict_impl \\ Map) do
d = dict_impl.new #=> creates an empty Dict
d1 = Dict.put(d,:foo,1)
d2 = Dict.put(d1,:bar,2)
print_vals(d2)
print_vals(Dict.put(d2,:foo,3))
def test_create do
IO.puts "< create Map.new >"
m = Map.new #=> creates an empty Map
m1 = Map.put(m,:foo,1)
m2 = Map.put(m1,:bar,2)
print_vals(m2)
print_vals(%{m2 | foo: 3})
end
defp print_vals(d) do
IO.inspect d
Enum.each(d, fn {k,v} -> IO.puts "#{k}: #{v}" end)
defp print_vals(m) do
IO.inspect m
Enum.each(m, fn {k,v} -> IO.puts "#{inspect k} => #{v}" end)
end
end
IO.puts "< create Map.new >"
RC.dict_create
IO.puts "\n< create HashDict.new >"
RC.dict_create(HashDict)
RC.test_create