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.
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^12: 99 Problems in Perl6
by gaal (Parson) on Dec 17, 2006 at 18:04 UTC |
In Section
Meditations