caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: "Loup Vaillant" <loup.vaillant@gmail.com>
To: pal_engstad@naughtydog.com
Cc: "Caml List" <caml-list@inria.fr>
Subject: Re: [Caml-list] Unexpected restriction in "let rec" expressions
Date: Thu, 28 Feb 2008 00:46:43 +0100	[thread overview]
Message-ID: <6f9f8f4a0802271546i407494ebm8ce10e98000c4313@mail.gmail.com> (raw)
In-Reply-To: <47C5B3EC.1080206@naughtydog.com>

Yahoo! I got it, many thanks!

2008/2/27, Pal-Kristian Engstad <pal_engstad@naughtydog.com>:
> Loup Vaillant wrote:
>  > loop :: ((a,c) -> (b,c)) -> a -> b
>  > loop f a = b
>  >   where (b,c) = f (a,c)
>
> Remember that values in Haskell are lazy, which simply means that they
>  are pointers to things that is either a pointer to a function to
>  evaluate it, or the cached value. (This works, since all Haskell values
>  are immutable.)

No problem with that. I just have some subtleties to learn about lazy
graph reduction yet. What is a bit harder is to turn myself in a
strictness analyzer when writing lazy code in my favorite strict
language :-).

> [...]
>
>  In other words, we're telling the compiler: Given a function f :: (a, c)
>  -> (b, c) and a value of type a, loop f a will give the result b by
>  evaluating (b, c') = f (a, c) where c' == c always.

That is the explanation I have waited for. I didn't have the idea to
push mathematical reasoning to the end, so I continued to bother
myself with an order of evaluation (even lazy), forgetting what a non
strict semantic really means. Thank you.

Loup

PS: do you use Ocaml (or whatever FP language or technique) at
naughtydog? What for, then (provided you can tell me, of course)?


      reply	other threads:[~2008-02-27 23:46 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-02-26 12:24 Loup Vaillant
2008-02-26 14:04 ` [Caml-list] " Jean-Christophe Filliâtre
2008-02-26 14:18 ` Damien Doligez
2008-02-26 14:34   ` Loup Vaillant
2008-02-26 14:51     ` Gabriel Kerneis
2008-02-26 14:56     ` blue storm
2008-02-26 17:48     ` Nicolas Pouillard
2008-02-26 14:57 ` Dirk Thierbach
2008-02-27  8:53 ` Andrej Bauer
2008-02-27  9:43   ` Loup Vaillant
2008-02-27 12:02     ` Dirk Thierbach
2008-02-27 14:04       ` Loup Vaillant
2008-02-27 16:41         ` Dirk Thierbach
2008-02-27 23:32           ` Loup Vaillant
2008-02-27 19:03 ` Pal-Kristian Engstad
2008-02-27 23:46   ` Loup Vaillant [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=6f9f8f4a0802271546i407494ebm8ce10e98000c4313@mail.gmail.com \
    --to=loup.vaillant@gmail.com \
    --cc=caml-list@inria.fr \
    --cc=pal_engstad@naughtydog.com \
    /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).