From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (from majordomo@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id TAA23159; Thu, 29 Jan 2004 19:33:15 +0100 (MET) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id TAA23513 for ; Thu, 29 Jan 2004 19:33:14 +0100 (MET) Received: from alex.baretta.com ([213.255.109.130]) by concorde.inria.fr (8.11.1/8.11.1) with ESMTP id i0TIXDP01408 for ; Thu, 29 Jan 2004 19:33:13 +0100 (MET) Received: from baretta.com (localhost.localdomain [127.0.0.1]) by alex.baretta.com (8.12.8/8.12.8) with ESMTP id i0TIXQWu004247; Thu, 29 Jan 2004 19:33:26 +0100 Message-ID: <401951F6.2030003@baretta.com> Date: Thu, 29 Jan 2004 19:33:26 +0100 From: Alex Baretta User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.5) Gecko/20031007 X-Accept-Language: en-us, en MIME-Version: 1.0 To: Thomas Fischbacher , ocaml Subject: Re: fancy types (was Re: [Caml-list] ocaml killer) References: <20040127063230.GA12482@inv_machine> <200401282326.i0SNQntl004612@bismarck-chet.watson.ibm.com> <40184A2F.6040007@dcs.qmul.ac.uk> <200401290000.i0T00ntl006988@bismarck-chet.watson.ibm.com> <40184FB9.4000808@dcs.qmul.ac.uk> <200401290034.i0T0Yutl009000@bismarck-chet.watson.ibm.com> <20040129162048.GA29094@force.stwing.upenn.edu> In-Reply-To: Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Loop: caml-list@inria.fr X-Spam: no; 0.00; baretta:01 baretta:01 caml-list:01 lovas:01 val:01 -rectypes:01 3.07:01 val:01 ocaml:01 ocaml:01 caml:01 alex:01 alex:01 int:01 int:01 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk Thomas Fischbacher wrote: > On Thu, 29 Jan 2004, William Lovas wrote: > # let fac n = let do_rec specialist n = if n = 0 then 1 else n * specialist specialist (n-1) in do_rec do_rec n;; > > Characters 74-84: > let fac n = let do_rec specialist n = if n = 0 then 1 else n * > specialist specialist (n-1) in do_rec do_rec n;; > > ^^^^^^^^^^ > This expression has type 'a -> 'b -> 'c but is here used with type 'a > > # let fac n = let do_rec specialist n = if n = 0 then 1 else n * (Obj.magic specialist) specialist (n-1) in do_rec do_rec n;; > val fac : int -> int = > > # fac 8;; > - : int = 40320 As far as I can see you are asking for no more than recursive types. [alex@alex graph]$ ocaml -rectypes Objective Caml version 3.07+2 # let fac n = let do_rec specialist n = if n = 0 then 1 else n * specialist specialist (n-1) in do_rec do_rec n;; val fac : int -> int = # fac 3;; - : int = 6 This is kind of thread where an RTFL comment might be appropriate. Alex ------------------- To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/ Beginner's list: http://groups.yahoo.com/group/ocaml_beginners