Matching fun M:F/A

Fred Hebert mononcqc@REDACTED
Mon Jan 6 16:07:02 CET 2020


On Sun, Jan 5, 2020 at 8:13 AM Richard O'Keefe <raoknz@REDACTED> wrote:

> I'm trying to think of a non-*accidental* semantics for fun patterns.
> fun _:_/n matches any function reference of arity n, which certainly
> has something to do with how we can call it.
> fun _:_/_ matches any function reference.
> I'm struggling to imagine plausible use cases for this.
> Do you have some examples?
>
>
The latter pattern is not different from the is_function/1 guard, but the
only place I can think of to call it (aside from serialization or hashing)
would be when passing it to apply/2, which accepts a fun and a list of
arguments.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20200106/43d3c726/attachment.htm>


More information about the erlang-questions mailing list