fact(match) =
0 or 1 -> 1
n -> n * fact(n - 1)
why not simply fact(0 or 1) -> 1
fact(n) -> n * fact(n - 1) fact(match) =
0 or 1 -> 1
n -> n * fact(n - 1)
why not simply fact(0 or 1) -> 1
fact(n) -> n * fact(n - 1)I think in Erlang the function identification is the name and the arity and this is as close I know of what you would like to have.
fact 0 = 0
fact 1 = 1
fact n = n * fact (n-1)
It works as you would expect and really they aren't that dissimilar. factorial(0) -> 1;
factorial(N) -> N * factorial(N-1).
factorial(Foo, 0) -> .. ;
factorial(Foo, Bar) -> .. .
Semicolons separate partial definitions for a single function of a single arity, and periods end those definitions. Removing the punctuation might make parsing a bit more difficult (will there be more partial definitions?), so it's understandable to not offer it.(some random link http://stackoverflow.com/questions/1050913/erlang-style-case...)