Mailing list for all users of the OCaml language and system.
 help / color / mirror / Atom feed
From: "Pierre-Evariste Dagand" <pedagand@gmail.com>
To: caml-list@yquem.inria.fr
Subject: Re: [Caml-list] "Ref" and copy of functions
Date: Sun, 16 Dec 2007 17:39:04 +0100	[thread overview]
Message-ID: <6cb897b30712160839g1efb65d2j449e4e2b66b847a1@mail.gmail.com> (raw)
In-Reply-To: <20071216.141725.55512483.garrigue@math.nagoya-u.ac.jp>

> Here is yet another solution, using objects, which actually combines
> Zheng's and Oleg's ideas. That is, it separates state and function,
> but provides only access to state through a cloning method, so that it
> is completely type safe. This is just what objects are good at!
>
> class ['a,'b] arrow (f : 'a -> 'b) =
>   object (self) method call = f method copy = self end

Yet another nice solution I would never have imagined :-)

And the performance is quite good :

1.428032 microseconds on my small benchmark

(the unsafe Ref implantation takes 0.75 microseconds while the CPS
implantation takes 2.7 microseconds).

Nevertheless, I have carried out my benchmark on Oleg's implementation
and find an impressive performance :

0.74 microseconds !

Now, I will re-write my combinators and see which style better suits my needs.

Thanks,

-- 
Pierre-Evariste DAGAND
http://perso.eleves.bretagne.ens-cachan.fr/~dagand/


  reply	other threads:[~2007-12-16 16:39 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-12-13 17:27 Pierre-Evariste Dagand
2007-12-14 10:49 ` Zheng Li
2007-12-14 14:51   ` [Caml-list] " David Teller
2007-12-14 16:19     ` Zheng Li
2007-12-14 14:54   ` [Caml-list] " Pierre-Evariste Dagand
2007-12-14 16:12     ` Zheng Li
2007-12-14 16:55       ` [Caml-list] " Pierre-Evariste Dagand
2007-12-14 16:30     ` Loup Vaillant
     [not found]       ` <6cb897b30712140848j52e5628avbf0e3dadcb771f71@mail.gmail.com>
2007-12-14 16:57         ` Pierre-Evariste Dagand
2007-12-16  5:17 ` [Caml-list] " Jacques Garrigue
2007-12-16 16:39   ` Pierre-Evariste Dagand [this message]
2007-12-16 18:27     ` Pierre-Evariste Dagand

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=6cb897b30712160839g1efb65d2j449e4e2b66b847a1@mail.gmail.com \
    --to=pedagand@gmail.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