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.1 required=5.0 tests=AWL,SPF_NEUTRAL autolearn=disabled version=3.1.3 X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from discorde.inria.fr (discorde.inria.fr [192.93.2.38]) by yquem.inria.fr (Postfix) with ESMTP id 378BABC6B for ; Sat, 23 Jun 2007 20:55:05 +0200 (CEST) Received: from nz-out-0506.google.com (nz-out-0506.google.com [64.233.162.232]) by discorde.inria.fr (8.13.6/8.13.6) with ESMTP id l5NIt4VX017171 for ; Sat, 23 Jun 2007 20:55:04 +0200 Received: by nz-out-0506.google.com with SMTP id s18so1042526nze for ; Sat, 23 Jun 2007 11:55:03 -0700 (PDT) DKIM-Signature: a=rsa-sha1; c=relaxed/relaxed; d=gmail.com; s=beta; h=domainkey-signature:received:received:message-id:date:from:to:subject:mime-version:content-type:content-transfer-encoding:content-disposition; b=rm4RnB+8gMj81mav93iEsCXZIBX3WjxWMB1IrwhstSMLqpLrYvEihDnPvQ/h8CF3re4dm0H810PTMkiHlUJJvHf9OfW1dnZiDq7hv5X/NiVASpTBvT2+UcHIx1RmTMNAibemNxAIW83b37hFqipSqw7qJZGNn0xNTWNI6RokLJE= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=beta; h=received:message-id:date:from:to:subject:mime-version:content-type:content-transfer-encoding:content-disposition; b=AfthHYIer04x6rX1h1shgPuQuNcYymFjIAimKTzVZXZzCrhDx1lNJSDidjKBNc8wZfEqV88xrwMYkw3ERisjmXbPiOz2EyXmpc2AKcOoNXu68mh58Hp9Hod1gslB9ws/k3wwT4wdWRaVqbzSbK4a0cjH1GJvD44D1kk8LOkhb9A= Received: by 10.142.83.4 with SMTP id g4mr93228wfb.1182624903001; Sat, 23 Jun 2007 11:55:03 -0700 (PDT) Received: by 10.143.168.5 with HTTP; Sat, 23 Jun 2007 11:55:02 -0700 (PDT) Message-ID: <9d3ec8300706231155p2429504ay6395ea0580756dc7@mail.gmail.com> Date: Sat, 23 Jun 2007 20:55:02 +0200 From: "Till Varoquaux" To: OCaml Subject: How do I get polymorphic partial application? MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline X-j-chkmail-Score: MSGID : 467D6C88.000 on discorde : j-chkmail score : X : 0/20 1 0.000 -> 1 X-Miltered: at discorde with ID 467D6C88.000 by Joe's j-chkmail (http://j-chkmail . ensmp . fr)! X-Spam: no; 0.00; expansions:01 expansions:01 val:01 cheers:01 polymorphic:01 polymorphic:01 partial:01 partial:01 int:01 semantic:02 seems:03 generally:03 let:03 let:03 generalized:04 Humm... I have a small issue here: I need to get the result of the partial application of a polymorphic function. Since variable are generalized in Let it is generally advised to use eta expansions, (i.e transform to a total application). sometimes eta expansions just won't do the trick, consider: let cntTag start= let cnt=ref start in fun v -> ((incr cnt;!cnt),v) the partial application is not fully polymorphic let tag1 = cntTag 1 has type val tag1 : '_a -> int * '_a = the eta expanded equivalent doesn't have the same semantic (it actually seems even less useful): let tag1 x= cntTag 1 x Is there an elegant solution to that problem? Cheers, Till -- http://till-varoquaux.blogspot.com/