Using Elixir pipeline to transform a string into a map
You can do this with an anonymous function

Enum.reduce(lines, %{}, fn(line, result) -&gt;
  String.split(line, ": ")
  |&gt; (fn(x) -&gt; Map.put(result, hd(x), List.last(x)) end).()
end)


You can also do it like this 

Enum.reduce(lines, [], fn(line, result) -&gt; result ++ String.split(line, ": ") end)
  |&gt; Enum.chunk(2)
  |&gt; Map.new(fn [k,  v] -&gt; {k, v} end)


which I less efficient, because it does 2 iterations, but I think it looks cleaner.