Enum.into alternatives and matching structs

Published on

Map.new/2

Instead of leveraging Enum.into/2 you can use Map.new/2 with an enumerable collection.

Pattern matching structs

I learned that you can pattern match structs.

def new(%_{} = struct), do: new_from_enum(struct)

References

  1. Github usage of of pattern matching a struct
  2. Reddit thread that introduced me to the ideas
  3. Map.new/2