On Tue, Aug 15, 2000 at 02:03:12PM +1000, Jeremy Howard wrote:
> The PDL team are now examining how to incorporate these kinds of features
> into perl 6. I'm also interested in seeing how to implement things like
> (from RFC 82)
> 
> <quote>
>   @b = (1,2,3);
>   @c = (2,4,6);
>   @d = (-2,-4,-6);
>   $sum = reduce ^_+^_, @b * @c + @d;

Well if operators were made to return iterators in a list context
then I can see that that would work. For example

  @b * @c would create an iterator which would return the
product of the elements in turn. <iter> + @d would 
be an iterator that return the sum of the next value from
<iter> and the next from @d. This final iterator is
what is passed to reduce. redice calls <iter>->next to
get the next value.

IMO, this should be possible.

Graham.

Reply via email to