AVL size

Stefan O'Rear stefanor at cox.net
Mon Aug 20 14:42:42 EDT 2007

On Mon, Aug 20, 2007 at 08:28:03AM -0300, Isaac Dupree wrote:
> Also there is are "small length"-like functions that tell what the size of 
> something is, up to a point, or "more than that"; this can probably be done 
> with lazy "elems"? (e.g. minMapSize of two maps, at O(min(m,n))

Thanks to type classes and laziness, implementing that is as easy as
providing a genericLength function, with lazy naturals taking the
remainder of the burden;
http://www.haskell.org/pipermail/haskell-cafe/2007-July/028503.html for
more details.

(Yes, this will be slower than a direct smallerThan operation, but if
it's an infrequently used operation the simplicity is probably worth it).

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
Url : http://www.haskell.org/pipermail/libraries/attachments/20070820/c54c89cf/attachment.bin

More information about the Libraries mailing list