Replace pipeline with composed function

At this point, the learner hasn't seen functions, the Enum module, or
the pipe operator, so it feels like a little much to add that here. The
reason it's needed is that the order of keys/1 and values/1 is reverse
of how it's defined. This is due to an implementation detail in Erlang's
maps. We /could/ use this as a learning opportunity rather than sorting
them, but I'm not sure what could be said about that...
This commit is contained in:
Jay Hayes
2016-05-03 19:28:57 -05:00
parent cb47a17da9
commit c39916df2e

View File

@@ -14,8 +14,8 @@ defmodule Maps do
end
koan "A map has keys and values" do
assert Map.keys(@person) |> Enum.sort == ___
assert Map.values(@person) |> Enum.sort == ___
assert Enum.sort(Map.keys(@person)) == ___
assert Enum.sort(Map.values(@person)) == ___
end
koan "Fetching a value returns a tuple with ok when it exists" do
@@ -43,7 +43,7 @@ defmodule Maps do
koan "Can remove pairs by key" do
without_age = Map.delete(@person, :age)
assert Map.keys(without_age) |> Enum.sort == ___
assert Enum.sort(Map.keys(without_age)) == ___
end
koan "Can merge maps" do