Hello! I’m trying to get more comfy with idiomatic elixir, and it seems like one line anonymous fn {} -> ... end calls might not be ideal. Maybe they are, but I’m curious if there’s a cleaner way to do a map over a map and get another map.
Is there a way to write this more concisely? At first I thought capture syntax might be the way, but I can’t find a function to capture that creates a tuple.
And for bonus points, can you destructure capture arguments? Because I also have one of these guys:
It took 5 replies to get the most straight solution for such a simple question. I believe normally people would write what mrkurt already wrote which is not “not concise” at all.
Oh my gosh these are great. That Map.new/2 function was exactly what I was looking for. My brain seems to handle the inline function better than complex capture.