At 11:23 AM 8/15/00 +0100, Graham Barr wrote:
>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.

I was actually thinking that @b * @c would boil down to a single vtable 
call--we'd just hit the multiply function for variable @b, and pass it a 
pointer to @c, and let it Do The Right Thing.

                                        Dan

--------------------------------------"it's like this"-------------------
Dan Sugalski                          even samurai
[EMAIL PROTECTED]                         have teddy bears and even
                                      teddy bears get drunk

Reply via email to