caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Damien.Doligez@inria.fr (Damien Doligez)
To: caml-list@margaux
Subject: Re: new library modules
Date: Wed, 5 May 93 11:53:31 +0200	[thread overview]
Message-ID: <9305050953.AA04243@couchey.inria.fr> (raw)

Xavier Leroy writes :

>I guess you mean (in the case of "set"):
[...]
>        type 'a ordering == 'a -> 'a -> int;;
>
>        type ('a, 'b) set_operations =
>          { empty: 'a t;
>            is_empty: 'a t -> bool;
>            mem: 'a -> 'a t -> bool;
>            add: 'a -> 'a t -> 'a t;
>            iter: ('a -> 'b) -> 'a t -> unit;
>            (* and so on *) };;
>
>        value make: 'a ordering -> ('a, 'b) set_operations;;

This is not what I meant.  What I meant was :

  type 'a t;;
  type 'a ordering == 'a -> 'a -> int;;

  value make : 'a ordering -> 'a t
  and   is_empty : 'a t -> bool
  and so on ...

and in the implementation :

  type 'a t = { my_order: 'a ordering; data: (* internal representation *) };;

This has the advantage that you cannot use the wrong ordering when working
with a given set, and that you do not have to use a type annotation when
creating the set (with the "make" function).

Damien Doligez




             reply	other threads:[~1993-05-05 15:43 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1993-05-05  9:53 Damien Doligez [this message]
  -- strict thread matches above, loose matches on Subject: below --
1993-05-07 10:29 cousinea
1993-05-07 10:23 cousinea
1993-05-04  9:14 cousinea
1993-05-04  9:38 ` Vale'rie Me'nissier-Morain
1993-05-05  2:25 ` Xavier Leroy
1993-05-03 18:45 Xavier Leroy

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=9305050953.AA04243@couchey.inria.fr \
    --to=damien.doligez@inria.fr \
    --cc=caml-list@margaux \
    /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).