From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Original-To: caml-list@sympa.inria.fr Delivered-To: caml-list@sympa.inria.fr Received: from mail3-relais-sop.national.inria.fr (mail3-relais-sop.national.inria.fr [192.134.164.104]) by sympa.inria.fr (Postfix) with ESMTPS id 206167EE34 for ; Thu, 17 Mar 2016 16:32:28 +0100 (CET) IronPort-PHdr: 9a23:zKNIWRa0aKJ9vmRZ76zvpWT/LSx+4OfEezUN459isYplN5qZpci5bnLW6fgltlLVR4KTs6sC0LqG9fi8EjNYqb+681k8M7V0HycfjssXmwFySOWkMmbcaMDQUiohAc5ZX0Vk9XzoeWJcGcL5ekGA6ibqtW1aJBzzOEJPK/jvHcaK1oLsh7D0o8GYPF0ArQH+SI0xBS3+lR/WuMgSjNkqAYcK4TyNnEF1ff9Lz3hjP1OZkkW0zM6x+Jl+73YY4Kp5pIYTGZn9Kq8xSLgdCDU9L0g04tfqvF/NV1ih/HwZB0wQjh1JBQWN1hD/Wprt+n/zsPZ62S+Xe9f3SLQ5RRyt6q5qTFnjjyJRZG1xy33elsEl1PETmxmmvREqm4M= Authentication-Results: mail3-smtp-sop.national.inria.fr; spf=None smtp.pra=antoine.rimlet@gmail.com; spf=Pass smtp.mailfrom=antoine.rimlet@gmail.com; spf=None smtp.helo=postmaster@mail-vk0-f49.google.com Received-SPF: None (mail3-smtp-sop.national.inria.fr: no sender authenticity information available from domain of antoine.rimlet@gmail.com) identity=pra; client-ip=209.85.213.49; receiver=mail3-smtp-sop.national.inria.fr; envelope-from="antoine.rimlet@gmail.com"; x-sender="antoine.rimlet@gmail.com"; x-conformance=sidf_compatible Received-SPF: Pass (mail3-smtp-sop.national.inria.fr: domain of antoine.rimlet@gmail.com designates 209.85.213.49 as permitted sender) identity=mailfrom; client-ip=209.85.213.49; receiver=mail3-smtp-sop.national.inria.fr; envelope-from="antoine.rimlet@gmail.com"; x-sender="antoine.rimlet@gmail.com"; x-conformance=sidf_compatible; x-record-type="v=spf1" Received-SPF: None (mail3-smtp-sop.national.inria.fr: no sender authenticity information available from domain of postmaster@mail-vk0-f49.google.com) identity=helo; client-ip=209.85.213.49; receiver=mail3-smtp-sop.national.inria.fr; envelope-from="antoine.rimlet@gmail.com"; x-sender="postmaster@mail-vk0-f49.google.com"; x-conformance=sidf_compatible X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: A0DoAgAPzepWizHVVdFeg2OBIwanbQQDhyKKd4Fvhz4HORMBAQEBAQEBARABAQEICwsJHzGCLYILIhEdARseAxIIAQc3AiQBEQEFARYnGodvAQMSoVqCB4ExPjGLNoFqgleFaAoZJw1RhBABBQoFhg+JTII0gToFh2qHAohogVCMMY8GjUURHoEPIgGCU4FSOy6KYwEBAQ X-IPAS-Result: A0DoAgAPzepWizHVVdFeg2OBIwanbQQDhyKKd4Fvhz4HORMBAQEBAQEBARABAQEICwsJHzGCLYILIhEdARseAxIIAQc3AiQBEQEFARYnGodvAQMSoVqCB4ExPjGLNoFqgleFaAoZJw1RhBABBQoFhg+JTII0gToFh2qHAohogVCMMY8GjUURHoEPIgGCU4FSOy6KYwEBAQ X-IronPort-AV: E=Sophos;i="5.24,350,1454972400"; d="scan'208,217";a="169207235" Received: from mail-vk0-f49.google.com ([209.85.213.49]) by mail3-smtp-sop.national.inria.fr with ESMTP/TLS/AES128-GCM-SHA256; 17 Mar 2016 16:32:27 +0100 Received: by mail-vk0-f49.google.com with SMTP id e185so106505215vkb.1 for ; Thu, 17 Mar 2016 08:32:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:date:message-id:subject:from:to; bh=zc4XnmL/nGPhxebVfYqbIF8XPq8N3TexGFW3OfFv2HA=; b=DzTxJ0+xHQbuKp8Xrr5eKUz13HlqTOKNQ4fAjS4HFRbANiGIOqW3JuloUoPahD7UNr B1PtSaE8I9SDZU9BvcV8Dn3ZaUIGZwZrczAxhPUSPv6/MdPyxMEucGbiqE7GG7rivlcH DmZ9JgxeMf2dBhLVYj52Vfx4Jzp9dqm9S8h3DKrhPnWhBIEyx0VTdGKkj2oq9hyN0r2z tzLy5UuAGdbsHeXBTx2WD3jQF85E4SQ4/SQ6sU1Wgc+SgoS4HuNqTUhXUTlJg2TGssqo U0js9kTY7BnbIEnje2G7teqILP9E9XGmX3L2wFdGbL2iYfNCzeISYOHW26Hzpv5+8dot BctQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:date:message-id:subject:from:to; bh=zc4XnmL/nGPhxebVfYqbIF8XPq8N3TexGFW3OfFv2HA=; b=FSCFEvXN4Jyac1cEawj6QO9VnWwzOAnhIhU8WavJIO7sPelz9SCGLKwOCPVjKkt2Ib Z48S2qyBV25QZZIqZK4+IIkWVE28ioR+uuahLKh5M7mszDfnBPjGepF/jxE0jgOkIQBp MFIDRZ3djgOltJ+6aDA6RmdvGCWZRKd1Dz+z8zRhXdFmrMwd1ChSJvS/SchBfWGHaY8z 5IKEM7GW5LMWxIcYL+3JkBik8XF9FdFXM0XQK8COACrEi/4eGXktRbo1XGg62y0mfkZ7 4414GLftEA1RGQ9+5U1vhhSfvwqFLQ0Aq0mAukNk4qwI83vQHuwBKKBMqHcshABB950x jw4w== X-Gm-Message-State: AD7BkJJp3erLlTrHwn7K+fj/Ayncc1848kroq/5yVDmWd2GFjzZsZsEtV0K7on8RPG1s8jTKhk1udNsgdVk4ZA== MIME-Version: 1.0 X-Received: by 10.31.148.144 with SMTP id w138mr11061193vkd.44.1458228746155; Thu, 17 Mar 2016 08:32:26 -0700 (PDT) Received: by 10.31.190.199 with HTTP; Thu, 17 Mar 2016 08:32:26 -0700 (PDT) Date: Thu, 17 Mar 2016 16:32:26 +0100 Message-ID: From: Antoine Rimlet To: caml-list@inria.fr Content-Type: multipart/alternative; boundary=001a11408c446a7d70052e405606 Subject: [Caml-list] let rec with let ref --001a11408c446a7d70052e405606 Content-Type: text/plain; charset=UTF-8 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 --001a11408c446a7d70052e405606 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
Hi,

I'm trying to write = a recursive function that would work like a for loop:
<= br>
let rec forloop g v u =3D
=C2=A0 let x =3D ref v in= let rec h =3D begin g !x; x :=3D !x + 1; if !x <=3D u then h end
<= div>=C2=A0 in h;;

I know this is horri= bly far from the functional spirit, but anyway ocaml complains that "T= his kind of expression is not allowed as right-hand side of `let rec'&q= uot;. 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?

<= /div>
Many thanks in advance,

Antoine

--001a11408c446a7d70052e405606--