caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Alain Frisch <alain@frisch.fr>
To: Andreas Rossberg <rossberg@mpi-sws.org>,
	 Brigitte Pientka <bpientka@cs.mcgill.ca>
Cc: OCaML List Mailing <caml-list@inria.fr>
Subject: Re: [Caml-list] recursive records
Date: Fri, 08 Nov 2013 22:56:40 +0100	[thread overview]
Message-ID: <527D5E18.5040501@frisch.fr> (raw)
In-Reply-To: <EF3E99AA-C0A7-41A8-8936-C550F38DC41B@mpi-sws.org>

On 11/8/2013 9:17 PM, Andreas Rossberg wrote:
> An application like the one of delay is not a value.

One possible workaround for allowing such recursive bindings where 
references to the bound values are under abstractions which are not 
evaluated while tying the knot is to go through lazy values:

let ones =
  let rec ones = lazy {hd = 1; tl = delay (fun () -> Lazy.force ones)} in
  Lazy.force ones

(Of course, for this specific example, this is a little bit silly.)


-- Alain

  reply	other threads:[~2013-11-08 21:56 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-11-08 20:10 Brigitte Pientka
2013-11-08 20:17 ` Andreas Rossberg
2013-11-08 21:56   ` Alain Frisch [this message]
2013-11-09  4:02 ` oleg
2013-11-13  8:01   ` Arkady Andrukonis

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=527D5E18.5040501@frisch.fr \
    --to=alain@frisch.fr \
    --cc=bpientka@cs.mcgill.ca \
    --cc=caml-list@inria.fr \
    --cc=rossberg@mpi-sws.org \
    /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).