Version française
Home     About     Download     Resources     Contact us    
Browse thread
[Caml-list] tree walking with... specular rec functions? what else?
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: David Brown <caml-list@d...>
Subject: Re: [Caml-list] tree walking with... specular rec functions? what else?
On Mon, May 12, 2003 at 03:35:42PM +0200, Michal Moskal wrote:

>     On non-mutable structures, the behavior of (==) is
>     implementation-dependent.
> 
> Which means that lst = [] does not imply lst == [].
> 
> In other words, one should use:
> 
>  	if lst = [] then empty-code else full-code
> 
> or pattern matching, as you said.

Is it really not defined by Ocaml?  Ocaml implements the empty list as
the integer value zero.  Although (==) won't tell you if two cons-cells
have the same contents, it will tell you if they are the same.

So is there any implementation of a caml language where [] == [] isn't
always true, for any way that [] is generated?

The (=) has more overhead, and in this case, I'm not sure it is
necessary.

Dave

-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners