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: | -- (:) |
| From: | Dominique Martinet <asmadeus77@g...> |
| Subject: | Re: [Caml-list] Re: How important are circular lists/recursive objects? |
On 05/10/2007, skaller <skaller@users.sourceforge.net> wrote: > On Thu, 2007-10-04 at 23:36 +0200, rossberg@ps.uni-sb.de wrote: > > skaller <skaller@users.sourceforge.net> wrote: > > > > Note that stuff like: > > > > > > let rec x= (1,x) > > > > > > is not generally allowed: in functional terms it is ill-defined, > > > > It is disallowed in OCaml because it has a cyclic type, not because it is > > a cyclic value. Try with "ocaml -rectypes". > > lists have cyclic types too, they're not disallowed! Lists have a base case to end the cycle, your definition does not (it would be int*int*int...*int and infinity of time, wheras a list contains either a value (head) and a list (tail), either nothing (that is, the empty list [])