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 ADE217EE25 for ; Fri, 8 Nov 2013 21:10:35 +0100 (CET) Received-SPF: None (mail2-smtp-roc.national.inria.fr: no sender authenticity information available from domain of bpientka@cs.mcgill.ca) identity=pra; client-ip=132.206.51.234; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="bpientka@cs.mcgill.ca"; x-sender="bpientka@cs.mcgill.ca"; x-conformance=sidf_compatible Received-SPF: Pass (mail2-smtp-roc.national.inria.fr: domain of bpientka@cs.mcgill.ca designates 132.206.51.234 as permitted sender) identity=mailfrom; client-ip=132.206.51.234; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="bpientka@cs.mcgill.ca"; x-sender="bpientka@cs.mcgill.ca"; x-conformance=sidf_compatible; x-record-type="v=spf1" Received-SPF: None (mail2-smtp-roc.national.inria.fr: no sender authenticity information available from domain of postmaster@mail.cs.mcgill.ca) identity=helo; client-ip=132.206.51.234; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="bpientka@cs.mcgill.ca"; x-sender="postmaster@mail.cs.mcgill.ca"; x-conformance=sidf_compatible X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AlECAO5EfVKEzjPqnGdsb2JhbABZhwa9UxYOAQEBAQEIFAk8gk8EEXYCBSECEQJAGQgBAYd9m3SPCJJEgSmOW4JVgUUDiUKVCo8S X-IPAS-Result: AlECAO5EfVKEzjPqnGdsb2JhbABZhwa9UxYOAQEBAQEIFAk8gk8EEXYCBSECEQJAGQgBAYd9m3SPCJJEgSmOW4JVgUUDiUKVCo8S X-IronPort-AV: E=Sophos;i="4.93,662,1378850400"; d="scan'208";a="41818563" Received: from mail.cs.mcgill.ca ([132.206.51.234]) by mail2-smtp-roc.national.inria.fr with ESMTP; 08 Nov 2013 21:10:23 +0100 Received: from [132.206.3.31] (bongo.CS.McGill.CA [132.206.3.31]) by mail.cs.mcgill.ca (Postfix) with ESMTP id 5CC52BF98EB for ; Fri, 8 Nov 2013 15:10:22 -0500 (EST) Message-ID: <527D452E.90701@cs.mcgill.ca> Date: Fri, 08 Nov 2013 15:10:22 -0500 From: Brigitte Pientka User-Agent: Mozilla/5.0 (X11; Linux i686; rv:24.0) Gecko/20100101 Thunderbird/24.1.0 MIME-Version: 1.0 To: caml-list@inria.fr Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Subject: [Caml-list] recursive records I am playing around with using recursive records to define observations about streams simulating essentially the ideas described in "Copatterns:Programming infinite structures by observations" presented at POPL'13. type 'a susp = Susp of (unit -> 'a) type 'a str = {hd: 'a ; tl : ('a str) susp} let rec ones = {hd = 1 ; tl = Susp (fun () -> ones)} This works fine and many examples can be elegantly written this way. However, when I define the stream ones via the function delay, OCaml fails. let delay f = Susp f let rec ones = {hd = 1 ; tl = delay (fun () -> ones)};; Characters 15-53: let rec ones = {hd = 1 ; tl = delay (fun () -> ones)};; ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Error: This kind of expression is not allowed as right-hand side of `let rec' Could someone explain why this fails? Thanks, Brigitte