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=1.5 required=5.0 tests=AWL,DNS_FROM_RFC_ABUSE, SPF_NEUTRAL autolearn=disabled version=3.1.3 Received: from discorde.inria.fr (discorde.inria.fr [192.93.2.38]) by yquem.inria.fr (Postfix) with ESMTP id 2FB64BC68 for ; Sun, 29 Oct 2006 02:35:13 +0100 (CET) Received: from ug-out-1314.google.com (ug-out-1314.google.com [66.249.92.173]) by discorde.inria.fr (8.13.6/8.13.6) with ESMTP id k9T1ZCsv003344 for ; Sun, 29 Oct 2006 02:35:12 +0100 Received: by ug-out-1314.google.com with SMTP id 78so899459ugn for ; Sat, 28 Oct 2006 18:35:10 -0700 (PDT) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:subject:from:to:in-reply-to:references:content-type:date:message-id:mime-version:x-mailer:content-transfer-encoding; b=eJYASL+AdgzRqsZm2NsZhF+8uj16Pq4f1/BS3S8pwDzYIYpabRJyZ3irnpXBbd3rFhyiMUsjjLJFFQD288NtRpt1ee/9dRHbVlQCpTbDacIeNx0gjC9IRqiBEEakBUVvV+doU8cupt3WthXPcwEPDyCdVJ/nlXLre3tlhBmlKug= Received: by 10.67.100.17 with SMTP id c17mr1906618ugm; Sat, 28 Oct 2006 18:35:10 -0700 (PDT) Received: from ?10.0.0.41? ( [88.154.194.131]) by mx.google.com with ESMTP id 39sm1199574ugb.2006.10.28.18.35.09; Sat, 28 Oct 2006 18:35:09 -0700 (PDT) Subject: Re: [Caml-list] weird type behavior From: Kirill To: caml-list@yquem.inria.fr In-Reply-To: <1162084356.23148.64.camel@nfnl> References: <1162050549.23148.26.camel@nfnl> <20061028161226.GA28781@furbychan.cocan.org> <20061028161506.GA2596@furbychan.cocan.org> <1162083950.23148.58.camel@nfnl> <1162084356.23148.64.camel@nfnl> Content-Type: text/plain Date: Sun, 29 Oct 2006 03:34:49 +0200 Message-Id: <1162085689.23148.75.camel@nfnl> Mime-Version: 1.0 X-Mailer: Evolution 2.8.1 Content-Transfer-Encoding: 7bit X-j-chkmail-Score: MSGID : 45440550.000 on discorde : j-chkmail score : X : 0/20 1 X-Miltered: at discorde with ID 45440550.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Spam: no; 0.00; readable:01 lambda:01 pred:01 pred:01 0200,:01 polymorphism:01 ocaml:01 0200,:01 0100,:01 wrote:01 wrote:01 faq:01 faq:01 partial:01 partial:01 Here's the same code as in my second message, in shorter and arguably more readable form. createln function creates a Church's "lambda number". succ and pred, respectively, produce successive and preceding numbers to the given. let rec createln = function | 0 -> fun f x -> x | n -> fun f x -> f (createln (n-1) f x) ;; let succ lnum f x = f (lnum f x);; let pred lnum = let calc_last_pair = lnum ( fun pair -> let curr = car pair in cons (succ curr) curr ) ( cons (createln 0) (createln 0) ) in cdr calc_last_pair ;; On Sun, 2006-10-29 at 03:12 +0200, Kirill wrote: > Hi, > > Unfortunately, I wasn't able to infer, how to solve my problem from the > FAQ, nor from other sources. I can see that partial application somehow > interferes with polymorphism, and partial application does look > necessary for my task. Does it mean it's completely impossible in OCaml? > Or is there still some way to overcome the problem? > > -Kirill > > > On Sun, 2006-10-29 at 03:05 +0200, Kirill wrote: > > On Sat, 2006-10-28 at 17:15 +0100, Richard Jones wrote: > > > I think the answer to the second part of your question is here: > > > > > > http://caml.inria.fr/resources/doc/faq/core.en.html#eta-expansion > > > > > > Rich. > > >