caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Jon Harrop <jon@jdh30.plus.com>
To: caml-list@yquem.inria.fr
Subject: Re: [Caml-list] 'a Set?
Date: Wed, 26 Jan 2005 16:06:15 +0000	[thread overview]
Message-ID: <200501261606.15465.jon@jdh30.plus.com> (raw)
In-Reply-To: <003d01c503bc$dea027a0$0100a8c0@mshome.net>

On Wednesday 26 January 2005 15:36, Frédéric Gava wrote:
> ...
> Ok, I am agree.  It is just a remark about coherence of names of functions
> and
> interfaces of the modules in the stdlib. There is many ModuleName.S
> interfaces. Have the same names for functions that have the same semantics
> seems (to me) a good things. (for example, have a function cardinal  in the
> module Map, even if we could implemented this with a fold; the cardinal
> function of the Sets are could also be implemented with a fold)

There are several problems with this. Firstly, the name "cardinal". A set has 
cardinality. Lists and arrays have length. In C++ the equivalent function is 
"size". Should a map use one of those names or something else (is a map a 
_set_ of mappings? => "cardinal").

Secondly, there are numerous variants on a theme here. You suggest 
implementing Map.cardinal with a fold => O(n). This may be the best that can 
be done at the moment (assuming the internal representation stores maximum 
depth but not number of elements) but by storing the number of elements in 
all branches you could have O(1) "cardinal". Of course, there are other 
variants too (e.g. min = max = d depth => 2^d - 1 elements).

Ultimately, the core library is maintained by INRIA who can ill-afford to 
expend man-hours on adding arbitrary functionality to the core library. I 
would love to see such inclusions (and many others).

Perhaps I should make a webpage listing useful things for people to dabble 
on. :-)

Cheers,
Jon.


      reply	other threads:[~2005-01-26 16:04 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-01-25 23:54 Mike Hamburg
2005-01-26  8:25 ` [Caml-list] " Jean-Christophe Filliatre
2005-01-26 10:13   ` Frédéric Gava
2005-01-26 11:04     ` Radu Grigore
2005-01-26 12:04       ` Jacques Garrigue
2005-01-26 16:00         ` Alex Baretta
2005-01-26 16:14           ` Jacques Carette
2005-01-26 21:09           ` Mike Hamburg
2005-01-29  9:55         ` Radu Grigore
2005-01-26  9:13 ` Jon Harrop
2005-01-26 15:36   ` Frédéric Gava
2005-01-26 16:06     ` Jon Harrop [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200501261606.15465.jon@jdh30.plus.com \
    --to=jon@jdh30.plus.com \
    --cc=caml-list@yquem.inria.fr \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).