PatternMetonyms.fit
You're seeing just the macro
fit
, go back to PatternMetonyms module for more information.
Replaces all occurences of =/2
in the do block by fit/2
iex> import PatternMetonyms
...> fit do
...> (Kernel.+(1) -> x) = 1
...> (Kernel.-(1) -> y) = 41
...> end
...> x + y
42
iex> import PatternMetonyms
...> fit(do: (Kernel.+(1) -> x) = (Kernel.-(1) -> y) = 21)
...> x + y
42
=/2
equivalent to view, named form.
iex> import PatternMetonyms
...> pat = fn {:Just, x} -> x end
...> fit((pat.() -> n), {:Just, 3})
...> n + 1
4
Underscore prefixed variables are ignored, they are therefore unusable outside
fit/2
's first argument.
Because of the lack of operator with the same associativity and precedence as =/2
,
no operator form of fit/2
is planned. It would otherwise result in unintuitive behaviors.
Left nesting of fit/2
will result in a compilation error.