Version française
Home     About     Download     Resources     Contact us    
Browse thread
How important are circular lists/recursive objects?
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Ville-Pertti Keinonen <will@e...>
Subject: Re: [Caml-list] How important are circular lists/recursive objects?

On Apr 3, 2007, at 2:55 AM, Brian Hurt wrote:

> The question is: if this behavior was completely outlawed, and  
> either you couldn't build up circular lists/recursive data  
> structures of this type at all, or had to call special functions  
> (List.circularize, say), to create them, would this be a  
> signifigant problem?  Does anyone actually use this construct, and  
> if so, for what?

Are you referring to all cases of let rec for non-functions, or just  
those that include "bare" self-references?  Most of the cases I can  
think of involve closures (so they're not necessarily cyclic, merely  
self-referential), e.g. useful lazy lists can often be constructed  
with something like:

let rec l = LazyList (1, lazy (do_something l))