From: Xavier Leroy <Xavier.Leroy@inria.fr>
To: caml-list@inria.fr
Cc: jeannin@cs.cornell.edu
Subject: Re: [Caml-list] Generating coinductive elements
Date: Mon, 30 Apr 2012 18:50:23 +0200 [thread overview]
Message-ID: <4F9EC2CF.5090202@inria.fr> (raw)
In-Reply-To: <4F9EBF8C.2060309@cs.cornell.edu>
Hello Jean-Baptiste,
> Let us take an example using streams (infinite lists) of numbers:
>
> type stream = Cons of int * stream
You won't go far with this type for integer streams, as the only way
to construct values of this type is "let rec", and it's severely
restricted (because of call-by-value requirements). For instance, you
can't even define the stream of all integers 0.1.2.3.4...
The proper OCaml type for integer streams is
type stream = Cons of int * stream Lazy.t
and with this type you should be able to do pretty much everything you
want to do with your equations.
HTH,
- Xavier Leroy
next prev parent reply other threads:[~2012-04-30 16:51 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-04-30 16:36 Jean-Baptiste Jeannin
2012-04-30 16:50 ` Xavier Leroy [this message]
2012-05-01 11:36 Jonathan Kimmitt
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=4F9EC2CF.5090202@inria.fr \
--to=xavier.leroy@inria.fr \
--cc=caml-list@inria.fr \
--cc=jeannin@cs.cornell.edu \
/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).