Mailing list for all users of the OCaml language and system.
 help / color / mirror / Atom feed
From: "Frédéric Gava" <frederic.gava@wanadoo.fr>
To: <skaller@users.sourceforge.net>
Cc: <caml-list@yquem.inria.fr>
Subject: Re: [Caml-list] Objective Caml release 3.08.2
Date: Thu, 25 Nov 2004 19:05:55 +0100	[thread overview]
Message-ID: <008001c4d319$693f0f40$b18780d9@mshome.net> (raw)
In-Reply-To: <1101398012.9291.48.camel@pelican.wigram>

> > Why an order for the fold operator ?
>
> Because Set.t is an ordered container,
Ok, but it is an abstract type : you do not know (except when you used
ocamlbrowser) how it works
and you do not need it (you do not want to know how really work the Thread
for example (simple user point of view) ).

> and order matters for folds if the operator being folded
> isn't associative.
Ok. That's right. This is why I thinks, another fold is necessary for
associative operators (and thus for possible optimizations of this fold) and
thus wihtout side-effects.

> These functions are deterministic and depend on order:
> Set.min_elt, Set.max_elt, Set.elements, Set.fold, Set.iter

Ok, for Set.iter  but Set.elements could also give the elements of the set
in any order: you need to specify to the SGBD that you want an ordered table
in SQL, why here it is necessary. You can  sort your list if you need
(peraps it takes more time but two functions could be give to the users:
Set.elements and Set.order_elements). A Set.elements without ordering the
elements would be more efficient.

 > Set.choose, however, chooses at random, and Set.for_all
> doesn't appear to be ordered either (is that a bug
> in the doc or deliberate?)
What would be the interest of sorting all the times the elements ?

Frédéric Gava



  reply	other threads:[~2004-11-25 18:04 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-11-24 13:06 Damien Doligez
2004-11-25 14:47 ` [Caml-list] " Frédéric Gava
2004-11-25 15:53   ` skaller
2004-11-25 18:05     ` Frédéric Gava [this message]
2004-11-25 18:32       ` Christophe TROESTLER
2004-11-26 23:10         ` Frédéric Gava
2004-11-25 21:47       ` Jon Harrop
2004-11-25 23:34       ` skaller
2004-11-26  8:45         ` Frédéric Gava
2004-11-26  1:20 ` Aleksey Nogin

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='008001c4d319$693f0f40$b18780d9@mshome.net' \
    --to=frederic.gava@wanadoo.fr \
    --cc=caml-list@yquem.inria.fr \
    --cc=skaller@users.sourceforge.net \
    /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