Use Collectable protocol with an empty map

This commit is contained in:
Colin Sheaff
2020-01-09 22:08:39 -06:00
parent de8f1f800f
commit 8887dbab1e

View File

@@ -25,8 +25,7 @@ defmodule Comprehensions do
end
koan "Add the result of a comprehension to an existing collection" do
collection = ["Apple Pie"]
collection = for x <- ["Pecan", "Pumpkin"], into: collection, do: "#{x} Pie"
collection = for x <- ["Pecan", "Pumpkin"], into: %{}, do: {x, "#{x} Pie"}
assert collection == ___
end