From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by yquem.inria.fr (Postfix) with ESMTP id 75EA4BBBB for ; Tue, 28 Mar 2006 03:12:47 +0200 (CEST) Received: from pauillac.inria.fr (pauillac.inria.fr [128.93.11.35]) by concorde.inria.fr (8.13.0/8.13.0) with ESMTP id k2S1ClMg027686 for ; Tue, 28 Mar 2006 03:12:47 +0200 Received: from nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id DAA22053 for ; Tue, 28 Mar 2006 03:12:46 +0200 (MET DST) Received: from einhorn.in-berlin.de (einhorn.in-berlin.de [192.109.42.8]) by nez-perce.inria.fr (8.13.0/8.13.0) with ESMTP id k2S1CjME030201 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=FAIL) for ; Tue, 28 Mar 2006 03:12:46 +0200 X-Envelope-From: oliver@first.in-berlin.de X-Envelope-To: Received: from first.in-berlin.de (e178055134.adsl.alicedsl.de [85.178.55.134]) (authenticated bits=0) by einhorn.in-berlin.de (8.13.6/8.12.10/Debian-4) with ESMTP id k2S1CjfG029094 for ; Tue, 28 Mar 2006 03:12:45 +0200 Received: by first.in-berlin.de (Postfix, from userid 501) id C544123CC78; Tue, 28 Mar 2006 03:11:59 +0200 (CEST) Date: Tue, 28 Mar 2006 03:11:59 +0200 From: Oliver Bandel To: caml-list@inria.fr Subject: Re: [Caml-list] Lambda-Term (f x) (x f) translated to Ocaml? Message-ID: <20060328011159.GA841@first.in-berlin.de> References: <24000351.1143506695382.JavaMail.www@wwinf1608> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <24000351.1143506695382.JavaMail.www@wwinf1608> User-Agent: Mutt/1.5.6i X-Scanned-By: MIMEDefang_at_IN-Berlin_e.V. on 192.109.42.8 X-Miltered: at concorde with ID 44288D8F.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Miltered: at nez-perce with ID 44288D8D.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Spam: no; 0.00; bandel:01 in-berlin:01 translated:01 ocaml:01 lambda:01 translated:01 ocaml:01 3.09.0:01 -rectypes:01 3.09.0:01 val:01 28,:98 2006:98 wrote:01 oliver:01 X-Spam-Checker-Version: SpamAssassin 3.0.3 (2005-04-27) on yquem.inria.fr X-Spam-Level: X-Spam-Status: No, score=0.1 required=5.0 tests=FORGED_RCVD_HELO autolearn=disabled version=3.0.3 On Tue, Mar 28, 2006 at 02:44:55AM +0200, yoann padioleau wrote: > > > Hello, > > > > I'm not firm in lambda calculus, what is the lambda-term > > in the subject translated to OCaml? > > > > Is this possible? > > the ocaml interpreter dont want this definition > > let g f x = (f x) (x f) Oh, looks easy.... ( at least the definition on the left side ;-) ) > > and shout: > this expression has type ('a -> 'b) -> 'c -> 'd but is here used with type 'a OK, I tried this: ===================================================================== first:~/Desktop oliver$ ocaml Objective Caml version 3.09.0 # let g f x = (f x) (x f) ;; This expression has type ('a -> 'b) -> 'c -> 'd but is here used with type 'a # ^D first:~/Desktop oliver$ ocaml -rectypes Objective Caml version 3.09.0 # let g f x = (f x) (x f) ;; val g : (('a -> 'c as 'b) -> 'c -> 'd as 'a) -> 'b -> 'd = # ===================================================================== Well, looks complicated to me. Any hints to this? Ciao, Oliver