Hey I have a list of structs and it has fields like: id, date, counter etc
how would i take out every id from this list and return the ids as a new list?
As NobbZ said, something like:
Enum.map(my_structs, fn %{id: id} -> id end)
2 Likes
I ended up doing this
Enum.map(x, fn y -> y.user_event.user_id end)
You might use the short version, like this
Enum.map(x, & &1.user_event.user_id)
2 Likes
love it thanks