[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Proposal: count
Taylor R Campbell wrote:
Date: Sun, 20 Sep 2009 18:58:38 -0400
From: David Van Horn <dvanhorn@xxxxxxxxxxx>
While `length' gives you number of pairs in a list, it's also useful to
determine the number of pairs in a (potentially) improper list.
When might one want to do this?
It's useful for bounds checking. Actually, I think a more useful
operation would be something like:
(lenth<=? obj k) -> bool
Which would be the same as (<= (count obj) k). This operation would
take O(min(log(count obj),log k)). It's important to note that obj need
not be a list.