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-08 (17:18)
From: Alex Baretta <alex@b...>
Subject: Re: [Caml-list] Recursive lists
David Brown wrote:
> On Fri, Oct 08, 2004 at 04:42:44PM +0200, Alex Baretta wrote:
>>Keith Wansbrough wrote:
> I doubt that most users of list operations want the extra overhead needed
> to check for cycles.  Recursive lists are fairly rare in strict languages.

I agree. They are very rarely of any use.

> Dave

I agree. I would not want the overhead in general, unless I knew 
beforehand that cyclic list are possible. But this is an optimization we 
can count on so long as we can prove the invariant that our structures 
are not cyclic. This is obvious in the core language (no Obj), but might 
not be so if functions linke cycle are available. When the invariant 
cannot be proven valid for all meaningful input, or when it is known 
that the input can reasonably be cyclic, then I argue that the standard 
library should provide some means to manipulate the such structures 
safely. Of course, a separate Cyclic_list module could be defined to 
access the cyclic-safe functions, but from an abstract point of view 
such functions logically belong to List.


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