Luke Palmer wrote:

>>On 9/29/05, Dave Whipp <[EMAIL PROTECTED]> wrote:
>  
>
>>>>   for grep {defined} @in -> $item, ?$next {
>>>>     print $item unless defined $next && $item eq $next;
>>>>   }
>>>>    
>>>>
>>    
>>
>
>>This is an interesting idea.  Perhaps "for" (and "map") shift the
>>minimum arity of the block from the given list and bind the maximum
>>arity.  Of course, the minimum arity has to be >= 1 lest an infinite
>>loop occur.  
>  
>

Or not. We've already seen idioms like

  for (;;) ...

If you specify your minimum arity as 0, then you're obviously planning to deal 
with it. This presumes that iterators can handle behind-the-scenes updating, of 
course.


>>But then perhaps you have another way to avoid integer
>>indices:
>>
>>    for @list -> $this, [EMAIL PROTECTED] {
>>        ...
>>    }
>>
>>As long as you don't look backwards.  Looking backwards makes problems
>>for GC in lazy contexts, so this might just be perfect.
>
Plus it's hard to talk about backwards. If you say

for @l -> ?$prev, $curr, ?$next {...}

what happens when you have two items in the list? I think we're best off using 
signature rules: optional stuff comes last.


=Austin




Reply via email to