I\'m rebuilding something in Elixir from some code I built in C#.
It was pretty hacked together, but works perfectly (although not on Linux, hence rebuild).
I am also new to Elixir but here is a cute and simple solution that uses pattern matching and recursion.
defmodule YourModule do
def reduce_list([], reduced) do reduced end
def reduce_list([first | rest ], reduced) do
# Do what you need to do here and call the function again
# with remaining list items and updated map.
reduce_list(rest, Map.put(reduced, first, "Done"))
end
end
And call the function with just the list you want to map and an empty map
> YourModule.reduce_list(["one", "two", "three"], %{})
%{"one" => "Done", "three" => "Done", "two" => "Done"}