caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* How important are circular lists/recursive objects?
@ 2007-04-02 23:55 Brian Hurt
  2007-04-03  6:24 ` Gleb Alexeyev
                   ` (4 more replies)
  0 siblings, 5 replies; 18+ messages in thread
From: Brian Hurt @ 2007-04-02 23:55 UTC (permalink / raw)
  To: caml-list


In Ocaml you have some ability to define recursive data structures.  The 
classic example of this is the circular list:

let rec example = 1 :: 2 :: example;;

There are obvious limitations to this sort of trick:

# let rec example = List.map (fun x -> x + 1) (1 :: 2 :: example);;
This kind of expression is not allowed as right-hand side of `let rec'
#

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?

Brian


^ permalink raw reply	[flat|nested] 18+ messages in thread

end of thread, other threads:[~2007-10-08  9:57 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-04-02 23:55 How important are circular lists/recursive objects? Brian Hurt
2007-04-03  6:24 ` Gleb Alexeyev
2007-04-03  6:58 ` [Caml-list] " Ville-Pertti Keinonen
2007-04-03  7:00 ` Andrej Bauer
2007-04-03 12:09   ` Jon Harrop
2007-04-03 13:31     ` Bruno De Fraine
2007-04-04 23:28   ` Brian Hurt
2007-04-05  0:51     ` Jon Harrop
2007-04-03 12:49 ` Philippe Wang
2007-04-04  3:52 ` Stefan Monnier
2007-04-04  5:28   ` [Caml-list] " skaller
2007-10-04 17:48     ` Fabrice Marchant
2007-10-04 20:39       ` skaller
2007-10-04 21:36         ` rossberg
2007-10-04 22:25           ` skaller
2007-10-05 10:42             ` Dominique Martinet
2007-10-08  9:57             ` Andreas Rossberg
2007-04-04  8:45   ` Don Syme

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).