2005/11/23, Larry Wall <[EMAIL PROTECTED]>:
>
> I think the last one is more feasible than the middle one, at least
> by default.  The problem is that stringification is considered a result
> of a kind of scalar context, and ordinary scalar context is not lazy
> in Perl 6.  So we'd probably need to set up some way of declaring
> "this particular string is lazy".
>
> Basically, we're attaching the whole lazy/nonlazy mess to the
> list/scalar distincion, which I think is a really good default.
> We use ** and lazy() to violate those defaults.

How about allowing reduce() to return a scalar with the same laziness
as the list:

    [EMAIL PROTECTED] - a lazy string if @list is lazy
    [EMAIL PROTECTED] - a lazy number if @list is lazy

It would look like:

    $foo = substr( [~](1..Inf), 10 );
    my $revfoo := reverse $foo;
    $revfoo ~~ s/foo/bar/g;

- Flavio S. Glock

Reply via email to