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 D265E7EE34 for ; Fri, 18 Mar 2016 12:36:57 +0100 (CET) IronPort-PHdr: 9a23:5s3yoxSxaPvjUJ09O9UCll88ANpsv+yvbD5Q0YIujvd0So/mwa64YBCN2/xhgRfzUJnB7Loc0qyN4/CmATFLuMvR+Fk5M7VyFDY9wf0MmAIhBMPXQWbaF9XNKxIAIcJZSVV+9Gu6O0UGUOz3ZlnVv2HgpWVKQka3CwN5K6zPF5LIiIzvjqbpq82VO1gD3WftKZpJbzyI7izp/vEMhoVjLqtjgjDomVBvP9ps+GVzOFiIlAz97MrjtLRq8iBXpu5zv5UYCfayLOwESulTBTEidmQ0/9HDtB/ZTALJ6GFPfH8Rl09nBBPa7ReyQJD3+gHgu+Zwwi2dIoWiQrcvRjWkqrkuQjf3hS1BOzNvozKfsdB5kK8O+EHpnBd42YOBOIw= Authentication-Results: mail3-smtp-sop.national.inria.fr; spf=None smtp.pra=goswin-v-b@web.de; spf=Pass smtp.mailfrom=goswin-v-b@web.de; spf=None smtp.helo=postmaster@mout.web.de Received-SPF: None (mail3-smtp-sop.national.inria.fr: no sender authenticity information available from domain of goswin-v-b@web.de) identity=pra; client-ip=212.227.17.11; receiver=mail3-smtp-sop.national.inria.fr; envelope-from="goswin-v-b@web.de"; x-sender="goswin-v-b@web.de"; x-conformance=sidf_compatible Received-SPF: Pass (mail3-smtp-sop.national.inria.fr: domain of goswin-v-b@web.de designates 212.227.17.11 as permitted sender) identity=mailfrom; client-ip=212.227.17.11; receiver=mail3-smtp-sop.national.inria.fr; envelope-from="goswin-v-b@web.de"; x-sender="goswin-v-b@web.de"; 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@mout.web.de) identity=helo; client-ip=212.227.17.11; receiver=mail3-smtp-sop.national.inria.fr; envelope-from="goswin-v-b@web.de"; x-sender="postmaster@mout.web.de"; x-conformance=sidf_compatible X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: A0A+AACL5+tWkwsR49RehQeoBIZKg2CHbQENgW+GDQKBLzgUAQEBAQEBAQEQAQEBAQcNCQkhL4ItghUBAQQyAVYLGAklDwUNGzSIEQEDEgS8Jx8rDYRVAQsBHYpigj6BfE6CX4IrBYdqhwKIOTGMD4FriS8KhViHMYdUHgEBglaBUmmKYwEBAQ X-IPAS-Result: A0A+AACL5+tWkwsR49RehQeoBIZKg2CHbQENgW+GDQKBLzgUAQEBAQEBAQEQAQEBAQcNCQkhL4ItghUBAQQyAVYLGAklDwUNGzSIEQEDEgS8Jx8rDYRVAQsBHYpigj6BfE6CX4IrBYdqhwKIOTGMD4FriS8KhViHMYdUHgEBglaBUmmKYwEBAQ X-IronPort-AV: E=Sophos;i="5.24,354,1454972400"; d="scan'208";a="169384741" Received: from mout.web.de ([212.227.17.11]) by mail3-smtp-sop.national.inria.fr with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 18 Mar 2016 12:36:57 +0100 Received: from frosties.localnet ([134.3.242.84]) by smtp.web.de (mrweb102) with ESMTPSA (Nemesis) id 0MEVlN-1aZyxV190T-00FiXg for ; Fri, 18 Mar 2016 12:36:56 +0100 Received: from mrvn by frosties.localnet with local (Exim 4.84) (envelope-from ) id 1agsi7-00059e-Nk for caml-list@inria.fr; Fri, 18 Mar 2016 12:36:55 +0100 Date: Fri, 18 Mar 2016 12:36:55 +0100 From: Goswin von Brederlow To: caml-list@inria.fr Message-ID: <20160318113654.GB18511@frosties> References: MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: User-Agent: Mutt/1.5.23 (2014-03-12) X-Provags-ID: V03:K0:jMqrmblH0B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subject: Re: [Caml-list] let rec with let ref On Thu, Mar 17, 2016 at 03:37:32PM +0000, vrotaru.md@gmail.com wrote: > 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 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 Also why use a ref? You need to define a function, not a value here anyway. let rec h x = ... then h (x+1) in h v MfG Goswin