in reply to Re^2: Functional Perl 6/PUGS
in thread Functional Perl 6/PUGS
FWIW, the code is not meant to be efficient, or real-world useful. It is meant to be an example of the argument pattern matching style of ML with perl6.
As for "why the hell would anyone program like this" question, the answer is that (virtually) no one really would.
However, it does illustrate the style of programming which is free of both assignment statements and side effects. This style is an area of interest in the study of concurrent programming (both non-assignment and single assignment variables actually). By not introducing side effects and limiting assignment you can remove an entire class of concurrent programming issues.
It is also useful to not think of this style of programming the way you view procedural execution. If you were to write these functions in prolog (or something similar like Erlang) the code would be quite similar, but since the execution model is much different, they are not as in-efficient as you might think.
And if you were stranded on a deserted isle with only functions and simple logical and comparison operators, and all your assignment statements, for & while loops, if statements etc, were lost at sea. You would have to program like this too.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^4: Functional Perl 6/PUGS
by BrowserUk (Patriarch) on Feb 28, 2005 at 18:38 UTC | |
by stvn (Monsignor) on Feb 28, 2005 at 20:14 UTC | |
by BrowserUk (Patriarch) on Feb 28, 2005 at 21:19 UTC |