Skip to content

Instantly share code, notes, and snippets.

@josevalim
Last active August 29, 2015 14:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save josevalim/11173516 to your computer and use it in GitHub Desktop.
Save josevalim/11173516 to your computer and use it in GitHub Desktop.

Before

A map pattern will match any map that has the given keys and values. For example, %{"hello" => world} will match any map that has the key "hello". An empty map therefore matches all maps.

After

A map pattern will match any map that has all the keys specified in the pattern. The values for the matching keys must also match. For example, %{"hello" => world} will match any map that has the key "hello" and assign the value to world, while %{"hello" => "world"} will match any map that has the key "hello"with value equals to"world". An empty map pattern (%{}`) will match all maps.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment