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-11 (09:04)
From: Keith Wansbrough <Keith.Wansbrough@c...>
Subject: Re: [Caml-list] Recursive lists
> On Fri, 8 Oct 2004, Keith Wansbrough wrote:
> > How could they do this?  It's just a list; there's nothing special
> > about it, except that it has no end.
> You can detect circular lists in O(N) thusly:
> let is_circular lst =

Yes, of course (and this is quite neat - I knew there was a
reasonable-space algorithm but couldn't recall it off the top of my
head).  But this is hardly something you want built into and
List.fold_{left,right}.  (as others have pointed out)

--KW 8-)

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