Re: how much detail can I get from caller.want?

2008-09-01 Thread TSa
HaloO, John M. Dlugosz wrote: Perhaps the supplier of the CPAN module for the nth function could also include, besides the actual function, an optimization pattern plug-in that locates the idiom in the parse tree and replaces the expression with a call to nth. Wouldn't a dispatch target

Re: how much detail can I get from caller.want?

2008-09-01 Thread Larry Wall
On Mon, Sep 01, 2008 at 05:52:28PM +0200, TSa wrote: HaloO, John M. Dlugosz wrote: Perhaps the supplier of the CPAN module for the nth function could also include, besides the actual function, an optimization pattern plug-in that locates the idiom in the parse tree and replaces the

Re: how much detail can I get from caller.want?

2008-09-01 Thread Brandon S. Allbery KF8NH
On 2008 Sep 1, at 15:20, Larry Wall wrote: On Mon, Sep 01, 2008 at 05:52:28PM +0200, TSa wrote: John M. Dlugosz wrote: Perhaps the supplier of the CPAN module for the nth function could also include, besides the actual function, an optimization pattern plug-in that locates the idiom in the

Re: how much detail can I get from caller.want?

2008-09-01 Thread Larry Wall
On Mon, Sep 01, 2008 at 03:40:39PM -0400, Brandon S. Allbery KF8NH wrote: On 2008 Sep 1, at 15:20, Larry Wall wrote: On Mon, Sep 01, 2008 at 05:52:28PM +0200, TSa wrote: John M. Dlugosz wrote: Perhaps the supplier of the CPAN module for the nth function could also include, besides the actual

Re: how much detail can I get from caller.want?

2008-08-31 Thread Xiao Yafeng
On Sat, Aug 30, 2008 at 4:22 AM, Dave Whipp [EMAIL PROTECTED] wrote: Lets say I want to find the 5th smallest element in an array. I might write: @array.sort.[4]; How does the implementation of the sort function know that I just want to 5th item (and thus choose an appropriate

Re: how much detail can I get from caller.want?

2008-08-31 Thread dpuu
On Aug 30, 8:47 am, [EMAIL PROTECTED] (John M. Dlugosz) wrote: Have the sort function simply return a lazy list object. When the [4] is called on that object, it knows to do as much work as needed, and can leave the rest as lazy. That may be half the answer, but simply making the decision

Re: how much detail can I get from caller.want?

2008-08-31 Thread John M. Dlugosz
dpuu dave-at-whipp.name |Perl 6| wrote: On Aug 30, 8:47 am, [EMAIL PROTECTED] (John M. Dlugosz) wrote: Have the sort function simply return a lazy list object. When the [4] is called on that object, it knows to do as much work as needed, and can leave the rest as lazy. That may be

Re: how much detail can I get from caller.want?

2008-08-30 Thread John M. Dlugosz
Have the sort function simply return a lazy list object. When the [4] is called on that object, it knows to do as much work as needed, and can leave the rest as lazy. --John Dave Whipp dave-at-whipp.name |Perl 6| wrote: Lets say I want to find the 5th smallest element in an array. I might

how much detail can I get from caller.want?

2008-08-29 Thread Dave Whipp
Lets say I want to find the 5th smallest element in an array. I might write: @array.sort.[4]; How does the implementation of the sort function know that I just want to 5th item (and thus choose an appropriate optimization)? Obviously the function could be told that it's caller wants 5