in reply to Re^10: 99 Problems in Perl6
in thread 99 Problems in Perl6
I agree with you here that ordered matching of sigs is convenient, even though it isn't as clear.
Standard ML guarantees ordered matching in functions (and also in lambdas and case expressions), so you can say this:
(this is not the best way to define factorial though).
fun fact 0 = 1 |
fact n = n * fact(n - 1);
Prolog also matches the heads of predicate definitions in order.
Mathematica is a bit different. It matches argument lists to more specific patterns first, and when it is not clear which pattern is more specific, it matches them in order.