Larry Wall writes:

> On Mon, May 08, 2006 at 05:30:23PM +0300, Gaal Yahas wrote:
> : We have a very nifty reduce metaoperator. Scans are a counterpart of
> : reduce that are very useful -- they are the (preferably lazy) list
> : of consecutive accumulated reductions up to the final result.

I'm obviously insufficiently imaginative.  Please can you give a few
examples of these things being very useful?

> Maybe that's just what reduce operators do in list context.

Instinctively I'm resistant to that, cos I can think of situations where
I'd invoke reduce operators (or where I already do the Perl 5
equivalent) wanting a reduction and where the code just happens to be in
list context: in a C<say> call, or in the block of a C<map>.  Having to
remember to use C<~> or C<+> to avoid inadvertently getting something
complicated I don't understand sounds like the kind of thing that would
trip me up.

But this could just be because I don't (yet) grok scans.


Reply via email to