caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Ben Millwood <bmillwood@janestreet.com>
To: Gerd Stolpmann <info@gerd-stolpmann.de>
Cc: Pippijn van Steenhoven <pip88nl@gmail.com>,
	caml users <caml-list@inria.fr>
Subject: Re: [Caml-list] Clarification for the configuration of comparison functions
Date: Wed, 10 Sep 2014 13:56:38 +0100	[thread overview]
Message-ID: <CA+MHO5025oSrvPRo4KaA4813XnY9V7962BqUfoMfh=y1FC=idg@mail.gmail.com> (raw)
In-Reply-To: <1410353499.3003.29.camel@thinkpad>

On 10 September 2014 13:51, Gerd Stolpmann <info@gerd-stolpmann.de> wrote:
> Am Mittwoch, den 10.09.2014, 13:41 +0100 schrieb Pippijn van Steenhoven:
>> Also, if you store the hash before the actual value, compare will
>> probably stop comparing after it finds that the hashes are not equal, so
>> you can simply use the polymorphic compare on t_cmp. I don't know this
>> for sure, since I haven't looked at the source, but I would assume this
>> is true.
>
> The OCaml manual doesn't define compare for tuples, so you cannot
> exploit that. I wouldn't bet that compare runs from left to right over
> the values, as OCaml is known for sometimes preferring right to left.
> But maybe this could be a future language feature? If the OCaml manual
> defined compare on tuples, this would in deed be a fine trick.

On the other hand, perhaps the fact that no-one is sure without
checking whether or not this works is indication enough that it is too
clever a trick for its own good, and just doing the obviously-right
thing is a more sensible option :)

  reply	other threads:[~2014-09-10 12:56 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-09-10  8:56 SF Markus Elfring
2014-09-10 11:27 ` Gerd Stolpmann
2014-09-10 12:07   ` Yotam Barnoy
2014-09-10 12:26     ` Gerd Stolpmann
2014-09-10 12:37       ` Adrien Nader
2014-09-10 12:38         ` Yotam Barnoy
2014-09-10 12:41       ` Pippijn van Steenhoven
2014-09-10 12:51         ` Gerd Stolpmann
2014-09-10 12:56           ` Ben Millwood [this message]
     [not found]       ` <CAADdkeKquMWyHjQhgd2SOZYr9DaS2E+i3Ug5=xb25BK-+n16eQ@mail.gmail.com>
2014-09-10 12:44         ` Gerd Stolpmann
2014-09-10 20:56   ` SF Markus Elfring
2014-09-11  7:46     ` Francois Berenger
2014-09-11  8:10       ` SF Markus Elfring
2014-09-11  8:24         ` Francois Berenger
2014-09-11  8:33           ` SF Markus Elfring
2014-09-11  8:39             ` Frédéric Bour
2014-10-06 20:50               ` SF Markus Elfring

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='CA+MHO5025oSrvPRo4KaA4813XnY9V7962BqUfoMfh=y1FC=idg@mail.gmail.com' \
    --to=bmillwood@janestreet.com \
    --cc=caml-list@inria.fr \
    --cc=info@gerd-stolpmann.de \
    --cc=pip88nl@gmail.com \
    /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).