From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (from majordomo@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id AAA19036; Thu, 4 Jul 2002 00:04:53 +0200 (MET DST) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f Received: from nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id AAA19010 for ; Thu, 4 Jul 2002 00:04:52 +0200 (MET DST) Received: from mel-rto6.wanadoo.fr (smtp-out-6.wanadoo.fr [193.252.19.25]) by nez-perce.inria.fr (8.11.1/8.11.1) with ESMTP id g63M4pH16115 for ; Thu, 4 Jul 2002 00:04:51 +0200 (MET DST) Received: from mel-rta7.wanadoo.fr (193.252.19.61) by mel-rto6.wanadoo.fr (6.5.007) id 3D18683700531E01 for caml-list@inria.fr; Thu, 4 Jul 2002 00:04:51 +0200 Received: from debian (80.8.83.124) by mel-rta7.wanadoo.fr (6.5.007) id 3D2131750013901A for caml-list@inria.fr; Thu, 4 Jul 2002 00:04:51 +0200 Received: from moi by debian with local (Exim 3.35 #1 (Debian)) id 17PsF8-0001Tt-00 for ; Thu, 04 Jul 2002 00:04:58 +0200 To: caml-list@inria.fr Subject: Re: [Caml-list] lazy lists References: <200207030945.g639jXd17537@orchestra.cs.caltech.edu> Mail-Copy-To: never From: Remi VANICAT Date: Thu, 04 Jul 2002 00:04:58 +0200 In-Reply-To: <200207030945.g639jXd17537@orchestra.cs.caltech.edu> (Michael Vanier's message of "Wed, 3 Jul 2002 02:45:33 -0700") Message-ID: <87ofdocvsl.dlv@wanadoo.fr> User-Agent: Gnus/5.090006 (Oort Gnus v0.06) Emacs/21.2 (i386-debian-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-15 Content-Transfer-Encoding: 8bit Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk Michael Vanier 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