Skip to main content


#elixir

3 iterations via pipe operator
people
|> Enum.filter(& &1.active)
|> Enum.map(&{&1.name, &1})
|> Enum.into(%{})

or 1 iteration via comprehension
for %{active: true} = person <- people, into: %{} do
  {<a href="http://person.name">person.name</a>, person}
end
Iā€™m just impressed you managed to insert a hashtag into a markdown post
ā‡§