Pin*_*juh 5 erlang function pattern-matching
由于Erlang是一种几乎纯粹的函数式编程语言,我想这是可能的:
case X of
foo(Z) -> ...
end.
Run Code Online (Sandbox Code Playgroud)
其中foo(Z)是可判定可逆的纯(无副作用)双射函数,例如:
foo(input) -> output.
Run Code Online (Sandbox Code Playgroud)
然后,在这种情况下X = output,Z将匹配为input.
在Erlang中是否可以使用这种语义,有或没有其他语法,而不是我的例子?