note
tye
<p>
If Perl were a functional programming language, I would
expect this:
<code>my @twice= map $doubler->($_), @list;
my @thrice= map $tripler->($_), @list;
</code>
to be easier to write than this:
<code>my @twice= map 2*$_, @list;
my @thrice= map 3*$_, @list;
</code>
I never said Perl doesn't let you use functional programming
techniques (in fact, I said the opposite).
</p><p>
Perl just has a preference for non-functional techniques.
[map] is one example. If you happen to have a closure,
then [map] requires you to write more code. If
Perl were a functional programming language, then you'd
probably have to create a closure if you had a code block
that you wanted to use with [map].
</p>
-
<a href="/index.pl?node=tye&lastnode_id=1072">tye</a>
(but my friends call me "Tye")
75792
75835