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
[Caml-list] Recursive lists
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2004-10-13 (11:21)
From: Alex Baretta <alex@b...>
Subject: Re: [Caml-list] Recursive lists
William Lovas wrote:
> On Sun, Oct 10, 2004 at 07:44:25PM -0500, Brian Hurt wrote:

>>Note: I haven't tested the above functions, but they give you the idea of 
>>how to handle circular lists.
> ... and this isn't it :)  I think Alex was more on the right track with the
> idea of maintaining a list of tails...
> cheers,
> William

Exactly: physical equality of nodes has nothing to do with the physical 
equality of lists. Ocaml allows sharing, so the same object can appear 
in more than one position even in an ordinary list or in any other Ocaml 


let l =
   let x = <...> in
   let y = <...> in
     [x; y; y; x; ...]

Here the first and fourth element are physically equal, as well as the 
second and third.


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