in reply to Re^2: list reversal closure
in thread list reversal closure
Put more simply, most languages assume the existence of command line arguments in an array, which eliminates the overhead of using the language or system libraries to process input for the test.
That does treat some languages more fairly, but it's not really reflective of any real world condition. You might as well begin by having the language explicitly set an array or variable with a specified input.
Side note on the closures bit -- a better, practical closures example is probably some sort of argument currying.
sub first_n_chars { my $n = shift; return sub { return substr( shift, 0, $n ) }; } my $first_4 = first_n_chars(4); print $first_4->("hello world");
-xdg
Code written by xdg and posted on PerlMonks is public domain. It is provided as is with no warranties, express or implied, of any kind. Posted code may not have been tested. Use of posted code is at your own risk.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^4: list reversal closure
by apotheon (Deacon) on Aug 21, 2006 at 19:37 UTC |