Skip to content

Instantly share code, notes, and snippets.

@zweizeichen
Created August 19, 2016 11:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save zweizeichen/2121a73f0d418dae539ad2c13e4a8f71 to your computer and use it in GitHub Desktop.
Save zweizeichen/2121a73f0d418dae539ad2c13e4a8f71 to your computer and use it in GitHub Desktop.
defmodule Yay do
def list_to_map([], map) do
map
end
def list_to_map(list, map) do
[key, value] = Enum.take(list, 2)
list_to_map(tl(tl(list)), Map.put(map, key, value))
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment