From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.1.3 (2006-06-01) on yquem.inria.fr X-Spam-Level: X-Spam-Status: No, score=0.6 required=5.0 tests=AWL autolearn=disabled version=3.1.3 X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from mail3-relais-sop.national.inria.fr (mail3-relais-sop.national.inria.fr [192.134.164.104]) by yquem.inria.fr (Postfix) with ESMTP id 79831BC69 for ; Thu, 25 Oct 2007 13:23:22 +0200 (CEST) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AgAAAL8YIEdEjuVjlmdsb2JhbACOWgIBAQcEBhERB4En X-IronPort-AV: E=Sophos;i="4.21,328,1188770400"; d="scan'208";a="5086892" Received: from smtp106.sbc.mail.re2.yahoo.com ([68.142.229.99]) by mail3-smtp-sop.national.inria.fr with SMTP; 25 Oct 2007 13:23:21 +0200 Received: (qmail 85049 invoked from network); 25 Oct 2007 11:23:20 -0000 DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=sbcglobal.net; h=Received:X-YMail-OSG:Message-ID:Date:From:User-Agent:MIME-Version:To:Subject:Content-Type:Content-Transfer-Encoding; b=ywSsi+ucwjwryTp1PntClLgB9WTsYgt82zVYURbuQVST20uRfqENfclCJ964YBhm01oUdgfiqo3RtcHdYgV6Dgbf6Q9qS25BkQIWtPSIad3rIK0zto3cp4RCUO6lcrTttjwNigFVxItL6D5UBBHpyGKRdWjhNWNjewREw5J4naU= ; Received: from unknown (HELO ?192.168.1.100?) (sesquized@sbcglobal.net@70.224.44.162 with plain) by smtp106.sbc.mail.re2.yahoo.com with SMTP; 25 Oct 2007 11:23:20 -0000 X-YMail-OSG: 0isBK5kVM1nuXL0IKdCsiVU4VewfOxwn5uNT6nVklWVrBEFfzjlA_MthVmCzEaIOBEivn1rDW6i2m_.yJCczx3EGt2wCr8PazvmgDn93V2.kfD1Ot6tLUeocyLpfESB7AUS7zN3eqLfo9uw- Message-ID: <47207C89.4090907@sbcglobal.net> Date: Thu, 25 Oct 2007 07:22:49 -0400 From: William Smith User-Agent: Thunderbird 2.0.0.6 (Windows/20070728) MIME-Version: 1.0 To: caml-list@yquem.inria.fr Subject: Re: [Caml-list] type abbreviation is cyclic Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Spam: no; 0.00; abbreviation:01 recursive:01 bool:01 subtrees:01 subtrees:01 recursion:01 recursive:01 abbreviation:01 sbcglobal:98 distilled:98 sbcglobal:98 wrote:01 wrote:01 rec:01 caml-list:01 I was just writing the simplest example of the recursive definition. I didn't know about -recftypes. The distilled version of the actual case follows type b = ((tree -> bool) * (b-> tree -> int)) list The first function of each pair determines whether the second function will be called. The second function recurses over the subtrees, possibly with different b control lists as their first argument. My actual example is more complex because of the details of the tree, but I think this is gives the flavor of what I'm trying to do. (snd b) can pass different list's into subtrees when it recurses. The actual example gets messier because another argument to snd b is a function that can use different rules to choose a row (or rows) from b. It's the recursion that can happen is related to the technique of writing recursive functions without using let rec.. let f1 it a1 b2 = ... let f2 it a1 b2 = .... let f3 it a1 b2 = ... let items = [f1; f2; f3] let x = f1 items a b... Till Varoquaux wrote: Type b doesn't exactly make much sens to me. While I could easilly define a value of type b (fun x:int _ -> x ) I really don't see the point. I'm gessing you'r trying to pass a chain of alternative functions (In which case this seems to be the wrong way). Could you give an exemple (without using Obj.magic) were you'd actually need such a type. On 10/24/07, William W Smith wrote: I wonder whether this error is an example of the language being defined more restrictively than required. What is the reason that I get these results? type a = int -> one -> int and one = Unused | One of a;; type b = int -> b -> int type a is accepted while type b is not. (b gives "The type abbreviation b is cyclic" However, in the uses that I intended, there won't be any actual difference between the two. I'd appreciate an explanation about why there is difference between a and b. Thanks Bill Smith