develooper Front page | perl.perl6.language | Postings from May 2005

Re: lazy context

Thread Previous | Thread Next
From:
C. Scott Ananian
Date:
May 20, 2005 14:16
Subject:
Re: lazy context
Message ID:
Pine.LNX.4.61.0505201713420.11673@cag.csail.mit.edu
On Fri, 20 May 2005, Yuval Kogman wrote:

> then it is not finalized into a real value. Here's how the range
> operator would be implemented:
>
> 	sub &infix:<..> ($from, $to where { $to < $from }){ reverse $to .. $from }
> 	sub &infix:<..> ($from, $to) { lazy gather {
> 		while ($from <= $to) {
> 			take($from++);
> 		}
> 	}}

This is very elegant.  It might be worthwhile for someone to attempt to 
define a 'core perl' set of operators, etc, so that the 'rest of perl' can 
be defined in perl proper...
  --scott

Pakistan FBI assassination Israel AVBUSY BATF ODEARL [Hello to all my fans in domestic surveillance] 
interception domestic disruption KMFLUSH ODENVY IDEA DES MI5 arrangements
                          ( http://cscott.net/ )

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About