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.0 required=5.0 tests=AWL 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 CAD9BBC68 for ; Sat, 28 Oct 2006 18:13:00 +0200 (CEST) Received: from furbychan.cocan.org (furbychan.cocan.org [80.68.91.176]) by discorde.inria.fr (8.13.6/8.13.6) with ESMTP id k9SGCwAl032708 (version=TLSv1/SSLv3 cipher=EDH-RSA-DES-CBC3-SHA bits=168 verify=NO) for ; Sat, 28 Oct 2006 18:13:00 +0200 Received: from rich by furbychan.cocan.org with local (Exim 3.35 #1 (Debian)) id 1GdqnL-0008K3-00; Sat, 28 Oct 2006 17:12:27 +0100 Date: Sat, 28 Oct 2006 17:12:27 +0100 To: Kirill Cc: caml-list@yquem.inria.fr Subject: Re: [Caml-list] weird type behavior Message-ID: <20061028161226.GA28781@furbychan.cocan.org> References: <1162050549.23148.26.camel@nfnl> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1162050549.23148.26.camel@nfnl> User-Agent: Mutt/1.5.9i From: Richard Jones X-Miltered: at discorde with ID 4543818A.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Spam: no; 0.00; 0200,:01 ocaml:01 foo:01 foo:01 beginners':01 ocaml:01 28,:98 blog:98 blog:98 beginners:01 polymorphic:01 wrote:01 faq:01 faq:01 caml-list:01 On Sat, Oct 28, 2006 at 05:49:08PM +0200, Kirill wrote: > I'm a novice user of OCaml and functional languages in general. While > playing with the interpreter, writing all kinds of functions, I've run > into a behavior that doesn't look quite right to me. Please excuse me, > if it is explained somewhere and I simply haven't gotten there yet. > > In the following example, I define a simple function foo that returns > function bar, which, in turn, accepts 2 parameters. The weird part is > that after bar is being called for the first time, its signature changes > from polymorphic types to ints. Right after (foo 3) call it's > '_a -> '_b -> '_b = > But after being called, it becomes > (int -> int) -> int -> int = Type variables like '_a are covered here: http://caml.inria.fr/pub/old_caml_site/FAQ/FAQ_EXPERT-eng.html#variables_de_types_faibles There's a mailing list for beginners' questions: http://tech.groups.yahoo.com/group/ocaml_beginners/ Rich. -- Richard Jones, CTO Merjis Ltd. Merjis - web marketing and technology - http://merjis.com Internet Marketing and AdWords courses - http://merjis.com/courses - NEW! Merjis blog - http://blog.merjis.com - NEW!