<?xml version="1.0" encoding="ISO-8859-1"?>

<!DOCTYPE message PUBLIC
  "-//MLarc//DTD MLarc output files//EN"
  "../../mlarc.dtd"[
  <!ATTLIST message
    listname CDATA #REQUIRED
    title CDATA #REQUIRED
  >
]>

  <?xml-stylesheet href="../../mlarc.xsl" type="text/xsl"?>


<message 
  url="2002/07/e405664acad7bbc76904048d851c9c56"
  from="Remi VANICAT &lt;vanicat@l...&gt;"
  author="Remi VANICAT"
  date="2002-07-03T22:04:53"
  subject="Re: [Caml-list] lazy lists"
  prev="2002/07/bc290463a2fb18079bf6f399c5a50e6f"
  next="2002/07/379fc8ca50542331d040d9378f63424c"
  prev-in-thread="2002/07/b063648a2dd6d86053cf686570b2117e"
  prev-thread="2002/07/729263137a5c609a8795ff7b62ccf4d0"
  next-thread="2002/07/51195de2a93bd54c617d9fca67b7ac46"
  root="../../"
  period="month"
  listname="caml-list"
  title="Archives of the Caml mailing list">

<thread subject="[Caml-list] lazy lists">
<msg 
  url="2002/07/b063648a2dd6d86053cf686570b2117e"
  from="Michael Vanier &lt;mvanier@c...&gt;"
  author="Michael Vanier"
  date="2002-07-03T16:15:57"
  subject="[Caml-list] lazy lists">
<msg 
  url="2002/07/e405664acad7bbc76904048d851c9c56"
  from="Remi VANICAT &lt;vanicat@l...&gt;"
  author="Remi VANICAT"
  date="2002-07-03T22:04:53"
  subject="Re: [Caml-list] lazy lists">
</msg>
</msg>
</thread>

<contents>
Michael Vanier &lt;mvanier@cs.caltech.edu&gt; writes:

&gt; What's the best way to write a lazy list data type in ocaml?  I've been
&gt; playing around with this datatype (from an old mailing list posting):
&gt;
&gt; type 'a stream =
&gt;   Nil
&gt; | Cons of 'a Lazy.t * 'a stream Lazy.t
&gt;
&gt; but I can't figure out how to write a "stream_cons" function.  

you mean :

let stream_cons x y =
  lazy Cons (x, y)


&gt; Also, it
&gt; appears that the Lazy.t data type uses references; why is this?

Because it is the standard way of doing it with a non lazy
language... 
-- 
Rémi Vanicat
vanicat@labri.u-bordeaux.fr
http://dept-info.labri.u-bordeaux.fr/~vanicat
-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners

</contents>

</message>

