Hello,

looking into Perl 6 syntax I noticed that there are meta- and
hyperoperators to perform among others the classical functional map
and fold operations. However, if I understood this correctly, you can
only use these constructs to lift scalar *operators* to the domain of
arrays.

Coming from a functional programming background (I write a lot of
Scheme code), I am very much accustomed to use map and fold
operations, but experience teaches me that a lot the the expressive
power offered by these operations comes not from the ability to pass a
predefined operator to them but rather from the fact that one can also
easily pass a custom operation.

Therefore I think that it would be a nice addition for Perl 6 if the
X...X, <<...>> and similar operators could be applied to anonymous
subroutines in addition to other operators. If such a syntactic change
wasn't possible it would probably be worthwhile to offer methods like
map and fold on array instances that take subroutine references as an
alternative.

cu,
Thomas


-- 
When C++ is your hammer, every problem looks like your thumb.

Reply via email to