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 UAA28842; Mon, 3 May 2004 20:42:12 +0200 (MET DST) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f 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 UAA28265 for ; Mon, 3 May 2004 20:42:11 +0200 (MET DST) Received: from mz2.forethought.net (mzpi4.forethought.net [216.241.36.13]) by nez-perce.inria.fr (8.12.10/8.12.10) with ESMTP id i43IgAEV018486 for ; Mon, 3 May 2004 20:42:10 +0200 Received: from [216.241.35.41] (helo=swordfish) by mz2.forethought.net with esmtp (Exim 4.30) id 1BKiOG-0005r6-OF for caml-list@pauillac.inria.fr; Mon, 03 May 2004 12:42:08 -0600 Received: from matt by swordfish with local (Exim 3.35 #1 (Debian)) id 1BKiOH-0004AR-00 for ; Mon, 03 May 2004 12:42:09 -0600 Date: Mon, 3 May 2004 12:42:09 -0600 From: Matt Gushee To: caml-list@pauillac.inria.fr Subject: Re: [Caml-list] OCaml error message Message-ID: <20040503184209.GA15860@swordfish> Reply-To: Matt Gushee Mail-Followup-To: caml-list@pauillac.inria.fr References: <14600.1083608359@www62.gmx.net> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <14600.1083608359@www62.gmx.net> User-Agent: Mutt/1.3.27i X-Miltered: at nez-perce with ID 40969282.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Loop: caml-list@inria.fr X-Spam: no; 0.00; gushee:01 mgushee:01 havenrock:01 caml-list:01 2004:99 schulz:99 ---cut---:01 ---cut---:01 'g':01 gushee:01 englewood:01 manure:01 mgushee:01 havenrock:01 ignores:01 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk On Mon, May 03, 2004 at 08:19:19PM +0200, Holger Schulz wrote: > I've following declarations > > ---cut--- > type rat = int * int;; > > exception Denominator_Zero;; > > let rec ggT : (int * int) -> int = fun (x,y) -> if y = 0 then x else ggT > (y, x mod y) > > let kgV : int * int -> int = fun (x,y) -> (x / ggT (x,y)) * y > > let kuerze : rat -> rat = function (m,n) -> if n = 0 then raise > Denominator_Zero > else let g=ggT (m,n) in (m div g,n div g) > ---cut--- > > Loading it with #use give the following error message, which I do not > understand. Could anyone help me? > This expression is not a function, it cannot be applied Sure. Syntactically speaking, the expression 'm div g' appears to be a call to function 'm' with arguments 'div' and 'g'. Of course, this doesn't work because 'm' is an integer. But actually I think your confusion is elsewhere. It looks like you were trying to use 'div' as a binary operator; as far as I know, there is no such operator. Try 'm / g' instead. By the way, when you get error messages like this, it is helpful to pay close attention to the *exact* position of the error--e.g., in this case, the message gave a range of characters pointing to 'm' (and maybe that character was underlined in the toplevel, too), so you know that the toplevel or compiler expected 'm' to be a function. -- Matt Gushee When a nation follows the Way, Englewood, Colorado, USA Horses bear manure through mgushee@havenrock.com its fields; http://www.havenrock.com/ When a nation ignores the Way, Horses bear soldiers through its streets. --Lao Tzu (Peter Merel, trans.) ------------------- 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