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 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 postcircumfix:<[ ]>:(LazySortedList,Int) >>> suffice when the sort would return such a thing? >> >> I suspect that warping the semantics of sort to support lazy readout >> will tend to adversely affect the performance of a normal sort (in >> an O(n²) kind of way), so I would rather optimize for sorting the > > You might want to take a look at the sort used by ghc (not the one in > the Haskell Prelude) before committing to that.
Yeah, but then I'd have to learn Haskell yet again. :) In any case, Haskell can depend on the absence of side effects in a way that Perl can only mandate by fiat. That's the price Perl pays for being mundane. Larry