From: "vrotaru.md@gmail.com" <vrotaru.md@gmail.com>
To: Antoine Rimlet <antoine.rimlet@gmail.com>, caml-list@inria.fr
Subject: Re: [Caml-list] let rec with let ref
Date: Thu, 17 Mar 2016 15:37:32 +0000 [thread overview]
Message-ID: <CAJgjwegSKAQpG1bJEd45ksW6cr+bNopAhuRwYmUoCBmY+SrOQQ@mail.gmail.com> (raw)
In-Reply-To: <CA+-Y6WUuM3hkcUBq-gNsbdMmbv7czuPYNXsaFBkRj4fShUe3gg@mail.gmail.com>
[-- Attachment #1: Type: text/plain, Size: 791 bytes --]
let rec h () = ... then h ()...
will define (and apply a function)
Iet rec value = .. value
is something totally different
În joi, 17 mar. 2016 la 17:33, Antoine Rimlet <antoine.rimlet@gmail.com> a
scris:
> Hi,
>
> I'm trying to write a recursive function that would work like a for loop:
>
> let rec forloop g v u =
> let x = ref v in let rec h = begin g !x; x := !x + 1; if !x <= u then h
> end
> in h;;
>
> I know this is horribly far from the functional spirit, but anyway ocaml
> complains that "This kind of expression is not allowed as right-hand side
> of `let rec'". It seems to me that this function definition has a meaning,
> so why is it rejected? What should I do to get it accepted by ocaml?
>
> Many thanks in advance,
>
> Antoine
>
>
[-- Attachment #2: Type: text/html, Size: 1290 bytes --]
next prev parent reply other threads:[~2016-03-17 15:37 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-03-17 15:32 Antoine Rimlet
2016-03-17 15:37 ` vrotaru.md [this message]
2016-03-18 11:36 ` Goswin von Brederlow
2016-03-18 11:55 ` Christoph Höger
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=CAJgjwegSKAQpG1bJEd45ksW6cr+bNopAhuRwYmUoCBmY+SrOQQ@mail.gmail.com \
--to=vrotaru.md@gmail.com \
--cc=antoine.rimlet@gmail.com \
--cc=caml-list@inria.fr \
/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