caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Remi VANICAT <vanicat@labri.u-bordeaux.fr>
To: caml-list@inria.fr
Subject: Re: [Caml-list] lazy lists
Date: Thu, 04 Jul 2002 00:04:58 +0200	[thread overview]
Message-ID: <87ofdocvsl.dlv@wanadoo.fr> (raw)
In-Reply-To: <200207030945.g639jXd17537@orchestra.cs.caltech.edu> (Michael Vanier's message of "Wed, 3 Jul 2002 02:45:33 -0700")

Michael Vanier <mvanier@cs.caltech.edu> writes:

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

you mean :

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


> Also, it
> 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


  reply	other threads:[~2002-07-03 22:04 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-07-03  9:45 Michael Vanier
2002-07-03 22:04 ` Remi VANICAT [this message]
2005-08-25 23:56 Jonathan Roewen
2005-08-26 10:56 ` Marius Nita
2005-08-26 11:04 ` Richard Jones
2005-08-26 11:16   ` Jun Mukai
2007-05-01 14:10 Yitzhak Mandelbaum
2007-05-01 15:47 ` [Caml-list] " Loup Vaillant
2007-05-01 19:43   ` Jon Harrop
2007-05-02  7:16     ` Nicolas Pouillard
2007-05-02 10:03       ` Loup Vaillant
2007-05-02 10:15         ` Daniel de Rauglaudre

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87ofdocvsl.dlv@wanadoo.fr \
    --to=vanicat@labri.u-bordeaux.fr \
    --cc=caml-list@inria.fr \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).