caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: "Nicolas Pouillard" <nicolas.pouillard@gmail.com>
To: "Christoph Bauer" <christoph.bauer@lms-gmbh.de>
Cc: caml-list <caml-list@inria.fr>
Subject: Re: [Caml-list] Streams and call-by-need
Date: Fri, 26 May 2006 17:17:36 +0200	[thread overview]
Message-ID: <cd67f63a0605260817q56fdc2bew33f0e7ddc5546eca@mail.gmail.com> (raw)
In-Reply-To: <26EB47FDD566A7469FC862DAF373792F013FE579@kaiserslautern1.lmsintl.com>

On 5/26/06, Christoph Bauer <christoph.bauer@lms-gmbh.de> wrote:
> Hi,
>
> do streams support call-by-need? This looks like call-by-name:
>
> #  let s = [< '(print_endline "a"); '(print_endline "b") >]
>   ;;
> val s : unit Stream.t = <abstr>
> # let t = [< s; s >]
>   ;;
> val t : unit Stream.t = <abstr>
> # Stream.next t;;
> a
> - : unit = ()
> # Stream.next t;;
> b
> - : unit = ()
> # Stream.next t;;
> a
> - : unit = ()
> # Stream.next t;;
> b
> - : unit = ()
>

Since your stream elements make function calls they are boxed in
functions taking unit.
Thus calls are delayed, but that's not real lazy values, the function
call is always done.

-- 
Nicolas Pouillard

      reply	other threads:[~2006-05-26 15:18 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-05-26 14:52 Christoph Bauer
2006-05-26 15:17 ` Nicolas Pouillard [this message]

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=cd67f63a0605260817q56fdc2bew33f0e7ddc5546eca@mail.gmail.com \
    --to=nicolas.pouillard@gmail.com \
    --cc=caml-list@inria.fr \
    --cc=christoph.bauer@lms-gmbh.de \
    /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).