Luke Palmer <[EMAIL PROTECTED]> writes:

> That's actually a very good idea.  That's why Perl 6 has it :-)
>
>     sub MediansBy5 ([EMAIL PROTECTED]) {
>         gather {
>             while @list >= 5 {   # there's no .length; it's .elems
>             take (sort @list.splice(0,5))[2];
>         }
>     }
>
> C<gather> returns a list of everything that was C<take>n inside of it.
> It does this by building a coroutine out of its argument, so it works
> lazily.

Okay.  I have to go back and reread what has been said about coroutines now.

-- 
$;=sub{$/};@;=map{my($a,$b)=($_,$;);$;=sub{$a.$b->()}}
split//,"[EMAIL PROTECTED]/ --";$\=$ ;-> ();print$/

Reply via email to