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 mail2-relais-roc.national.inria.fr (mail2-relais-roc.national.inria.fr [192.134.164.83]) by sympa.inria.fr (Postfix) with ESMTPS id EEF497EE34 for ; Fri, 18 Mar 2016 12:55:11 +0100 (CET) IronPort-PHdr: 9a23:a8byihM0q9I+WqkM6yUl6mtUPXoX/o7sNwtQ0KIMzox0KPn6rarrMEGX3/hxlliBBdydsKIUzbKL+Pm+ACQp2tWojjMrSNR0TRgLiMEbzUQLIfWuLgnFFsPsdDEwB89YVVVorDmROElRH9viNRWJ+iXhpQAbFhi3DwdpPOO9QteU1JTnkbjvsMSNOk1hv3mUX/BbFF2OtwLft80b08NJC50a7V/3mEZOYPlc3mhyJFiezF7W78a0+4N/oWwL46pyv50IbaKvdK09SflcDS86G2Ez/szi8xfZHiWV4X5JeWUMkwFUBBDF2zFkUZrr+n/xtvB8wzWdJc2wTbc5Vjm4x7t2DRXlkiMGMXg1/TeE2YRLkKtHrUf59FREyInObdTNOQ== Authentication-Results: mail2-smtp-roc.national.inria.fr; spf=None smtp.pra=christoph.hoeger@tu-berlin.de; spf=None smtp.mailfrom=christoph.hoeger@tu-berlin.de; spf=None smtp.helo=postmaster@mail.tu-berlin.de Received-SPF: None (mail2-smtp-roc.national.inria.fr: no sender authenticity information available from domain of christoph.hoeger@tu-berlin.de) identity=pra; client-ip=130.149.7.33; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="christoph.hoeger@tu-berlin.de"; x-sender="christoph.hoeger@tu-berlin.de"; x-conformance=sidf_compatible Received-SPF: None (mail2-smtp-roc.national.inria.fr: no sender authenticity information available from domain of christoph.hoeger@tu-berlin.de) identity=mailfrom; client-ip=130.149.7.33; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="christoph.hoeger@tu-berlin.de"; x-sender="christoph.hoeger@tu-berlin.de"; x-conformance=sidf_compatible Received-SPF: None (mail2-smtp-roc.national.inria.fr: no sender authenticity information available from domain of postmaster@mail.tu-berlin.de) identity=helo; client-ip=130.149.7.33; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="christoph.hoeger@tu-berlin.de"; x-sender="postmaster@mail.tu-berlin.de"; x-conformance=sidf_compatible X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: A0AVAQDd6+tWkyEHlYJehQq8GIYNAoExPBABAQEBAQEBARABAQEBCQsJCSEvgi2CFQEBBCMPAUURCxoCBRYLAgIJAwIBAgFFEwYCAQGIIwSyAY9eKnyJZoQ6ToI0glYFl1eIY45QhViPBjeCP4FSaYpjAQEB X-IPAS-Result: A0AVAQDd6+tWkyEHlYJehQq8GIYNAoExPBABAQEBAQEBARABAQEBCQsJCSEvgi2CFQEBBCMPAUURCxoCBRYLAgIJAwIBAgFFEwYCAQGIIwSyAY9eKnyJZoQ6ToI0glYFl1eIY45QhViPBjeCP4FSaYpjAQEB X-IronPort-AV: E=Sophos;i="5.24,354,1454972400"; d="scan'208";a="208603781" Received: from mail.tu-berlin.de ([130.149.7.33]) by mail2-smtp-roc.national.inria.fr with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 18 Mar 2016 12:55:11 +0100 X-tubIT-Incoming-IP: 91.65.203.239 Received: from ip5b41cbef.dynamic.kabel-deutschland.de ([91.65.203.239] helo=[192.168.178.42]) by mail.tu-berlin.de (exim-4.76/mailfrontend-8) with esmtpsa [UNKNOWN:AES128-SHA:128] for id 1agszl-0003e4-kW; Fri, 18 Mar 2016 12:55:10 +0100 To: caml-list@inria.fr References: <20160318113654.GB18511@frosties> From: =?UTF-8?Q?Christoph_H=c3=b6ger?= Organization: =?UTF-8?Q?Technische_Universit=c3=a4t_Berlin?= Message-ID: <56EBEC9D.6070508@tu-berlin.de> Date: Fri, 18 Mar 2016 12:55:09 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.6.0 MIME-Version: 1.0 In-Reply-To: <20160318113654.GB18511@frosties> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-PMX-Version: 6.0.0.2142326, Antispam-Engine: 2.7.2.2107409, Antispam-Data: 2016.3.18.114817 X-PMX-Spam: Gauge=IIIIIII, Probability=0%, Report='' Subject: Re: [Caml-list] let rec with let ref You should use this variant: let 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;; 1. forloop does not need to be recursive (and is not a syntactical function) 2. h is not a syntactical function, but can easily be made one. Recursive functions need to be syntactical functions (i.e. lambda-abstractions) in order to correctly compile them. regards, Christoph Am 18.03.2016 um 12:36 schrieb Goswin von Brederlow: > 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;; -- Christoph Höger Technische Universität Berlin Fakultät IV - Elektrotechnik und Informatik Übersetzerbau und Programmiersprachen Sekr. TEL12-2, Ernst-Reuter-Platz 7, 10587 Berlin Tel.: +49 (30) 314-24890 E-Mail: christoph.hoeger@tu-berlin.de