Version française
Home     About     Download     Resources     Contact us    

This site is updated infrequently. For up-to-date information, please visit the new OCaml website at

Browse thread
RE: [Caml-list] Are you sure the new "=" of 3.08 is good ?
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Harrison, John R <johnh@i...>
Subject: RE: [Caml-list] Are you sure the new "=" of 3.08 is good ?
| As I said in an earlier post, you can do
|   let (=?) x y = ( x y = 0)
| and use =? instead of = in places where you need the "early stop"
| behaviour.

OK. I wanted to be sure this was a recommended solution, not just
something that happens to work at the moment.

| Of course, if the speed of equality is critical, you can also define
| your own comparison functions for the types of interest, or even (as
| Damien suggested) implement hash-consing.

In fact, the key function is an alpha-conversion test on
name-carrying lambda-terms. Since it's almost always expected to
succeed with full equality after a shallow comparison, I now do an
equality test first to get the early-out behaviour. I can just
change it to put an "==" into the main recursion when it hasn't
gone through any lambdas.


To unsubscribe, mail Archives:
Bug reports: FAQ:
Beginner's list: