[Prev][Next][Index][Thread]
Re: count
In article
<Pine.GSO.3.96.1010305223944.28742C-100000@tardis.tardis.ed.ac.uk>,
Hugh Greene <q@tardis.ed.ac.uk> wrote:
> On Mon, 5 Mar 2001, Bruce Hoult wrote:
> > Is there any particular reason that Dylan doesn't have a "count()"
> > function built-in?
> > [snip useful function]
>
> I think the only reason is that there are so many equally often useful
> functions that, if we put them all in standard libraries, we'd end up with
> really huge standard libraries :-)
Yes, and I'm very sensitive to such concerns.
Quite apart from the sheer size of the standard and the implementation
effort, when a language has *too* many things build in you simply can't
learn them all and you end up rolling your own in your own code anyway,
because you didn't realise that it was already available...
It seems stange to me that Dylan has every? and any?, but not count,
given that every? and any? can both be efficiently created from count,
as count(coll, pred) >= 1 and count(coll, pred) = coll.size. Well,
OK, perhaps every? and any? are better to have an early-out
implementaion, but I certainly don't see how they are any more primitive
than count().
-- Bruce
Follow-Ups:
- Re: count
- From: Lyman Taylor <lyman.taylor@mindspring.com.NO.SPAM>
References:
- count
- From: Bruce Hoult <bruce@hoult.org>
- Re: count
- From: Hugh Greene <q@tardis.ed.ac.uk>