Help required in Elixir. Trying to convert each element of a list to a map with my own key, and only finding examples using .chunk_every(2) which does not do what I want.
Basically how do I transform this:
['a', 'b', 'c']
into this:
[%{text: a},
%{text: b},
%{text: c}]
@aynish It's almost this, but how do I recover the current value being processed?
For example I tried this:
Enum.each(blocks, fn x -> %{text: x} end)
But the blocks var doesn't change.
@thomasorus so you're saying you always get the full list in your unnamed function? hmmm
@thomasorus my bad, it is Enum.map
https://elixirschool.com/en/lessons/basics/enum/#map-4
Enum.each doesn't return a new enum
@aynish It's working, thanks!
@thomasorus something like
Enum.each([a, b, c], into: %{text: })?