develooper Front page | perl.fwp | Postings from March 2002

Re: Sort is lazy?!? (as in Haskell)

Thread Previous | Thread Next
From:
abigail
Date:
March 10, 2002 11:19
Subject:
Re: Sort is lazy?!? (as in Haskell)
Message ID:
20020310192007.1879.qmail@foad.org
On Sun, Mar 03, 2002 at 01:13:32PM -0500, Michael G Schwern wrote:
> PS  With a truly lazy sort you'd be able to do...
> 
> ($first) = sort { $a wibble $b } @big_list;  # in O(n) time.



Not necessarely - it would depend on the underlaying sorting mechanism.
Shell sort and heap sort for instance don't get the first element first.



Abigail

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