Created
June 21, 2019 11:06
-
-
Save koolquark/f566c75de71c2d986afa8df720451e6a to your computer and use it in GitHub Desktop.
Elixir - Map matching at function head
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
defmodule MapTest do | |
def hmap(%{ :a => "a"} = changeset) do | |
IO.inspect changeset | |
end | |
end | |
MapTest.hmap(%{ :a => "a", :b => "B" }) # matches | |
MapTest.hmap(%{ :a => "A", :b => "B" }) # clause error | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment