Browse thread
How important are circular lists/recursive objects?
[
Home
]
[ Index:
by date
|
by threads
]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: | 2007-04-03 (06:58) |
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))