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.6 required=5.0 tests=AWL,HTML_MESSAGE autolearn=disabled version=3.1.3 X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from mail1-relais-roc.national.inria.fr (mail1-relais-roc.national.inria.fr [192.134.164.82]) by yquem.inria.fr (Postfix) with ESMTP id 441C4BBAF for ; Mon, 4 Aug 2008 02:58:26 +0200 (CEST) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AqsGAPfwlUhQDPJjX2dsb2JhbACCJC2OZBcEBwgQMJs0 X-IronPort-AV: E=Sophos;i="4.31,302,1215381600"; d="scan'208,217";a="15778554" Received: from smtp28.orange.fr ([80.12.242.99]) by mail1-smtp-roc.national.inria.fr with ESMTP; 04 Aug 2008 02:58:26 +0200 Received: from me-wanadoo.net (localhost [127.0.0.1]) by mwinf2804.orange.fr (SMTP Server) with ESMTP id 65E1280000A1 for ; Mon, 4 Aug 2008 02:58:25 +0200 (CEST) Received: from Thinkpad-R60 (Mix-Lyon-303-1-46.w193-248.abo.wanadoo.fr [193.248.43.46]) by mwinf2804.orange.fr (SMTP Server) with SMTP id 5FA4480000A0 for ; Mon, 4 Aug 2008 02:58:24 +0200 (CEST) X-ME-UUID: 20080804005824391.5FA4480000A0@mwinf2804.orange.fr Date: Mon, 4 Aug 2008 03:00:06 +0200 From: "Damien Guichard" To: "caml-list@yquem.inria.fr" Subject: Re: [Caml-list] Error: This function is applied to too many arguments,maybe you forgot a `; ' X-mailer: Foxmail 5.0 [-fr-] Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="=====003_Dragon522436338336_=====" Message-Id: <20080804005824.5FA4480000A0@mwinf2804.orange.fr> X-Spam: no; 0.00; damien:01 guichard:01 damien:01 ocaml:01 ocaml:01 ocamlc:01 beginner's:01 bug:01 ocamlc:01 beginner's:01 bug:01 beginners:01 beginners:01 rec:01 rec:01 This is a multi-part message in MIME format. --=====003_Dragon522436338336_===== Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Hi, This line: print_int fac(6);; Can be read as: print_int fac 6;; That is 2 arguments whereas print_int expects exactly 1 argument. The corrected line is: print_int (fac 6);; Note that function application is just juxtaposition, parenthesis are unneded. Regards, - damien hi I try to make my first steps with Ocaml and I have some difficulties. I know there is a second list for "Ocaml Beginners" but its running on Yahoo and the membership confirmation takes a while ... So let me ask you, what is wrong with this code let rec fac n = if n > 1 then n * fac (n-1) else 1 ;; print_int fac(6);; No matter if I compile this with ocamlc or run the commands with ocaml, I always get the error: ///////////////////////////////////////////////////////////////// File "ifelse.ml", line 2, characters 0-9: This function is applied to too many arguments, maybe you forgot a `;' /////////////////////////////////////////////////////////////////// What is the problem here? Adding an additional ; doesn't help of course. thanks ben _______________________________________________ Caml-list mailing list. Subscription management: http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list Archives: http://caml.inria.fr Beginner's list: http://groups.yahoo.com/group/ocaml_beginners Bug reports: http://caml.inria.fr/bin/caml-bugs --=====003_Dragon522436338336_===== Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: 7bit
Hi,
 
This line:
 
    print_int fac(6);;
 
Can be read as:
 
    print_int fac 6;;
 
That is 2 arguments whereas print_int expects exactly 1 argument.
 
The corrected line is:
 
    print_int (fac 6);;
 
Note that function application is just juxtaposition, parenthesis are unneded.
 
Regards,
 
- damien
 
 

 
hi
I try to make my first steps with Ocaml and I have some difficulties.
I know there is a second list for "Ocaml Beginners" but its running on
Yahoo and the membership confirmation takes a while ...
 
So let me ask you, what is wrong with this code
 
let rec fac n = if n >  1 then n * fac (n-1) else 1 ;;
print_int fac(6);;
 
No matter if I compile this with ocamlc or run the commands with
ocaml, I always get the error:
/////////////////////////////////////////////////////////////////
File "ifelse.ml", line 2, characters 0-9:
This function is applied to too many arguments,
maybe you forgot a `;'
///////////////////////////////////////////////////////////////////
 
What is the problem here? Adding an additional ; doesn't help of course.
 
thanks
ben
 
_______________________________________________
Caml-list mailing list. Subscription management:
http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
Archives: http://caml.inria.fr
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
Bug reports: http://caml.inria.fr/bin/caml-bugs
 

--=====003_Dragon522436338336_=====-- 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.1 required=5.0 tests=AWL autolearn=disabled version=3.1.3 X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from mail2-relais-roc.national.inria.fr (mail2-relais-roc.national.inria.fr [192.134.164.83]) by yquem.inria.fr (Postfix) with ESMTP id 4BE5CBBAF for ; Mon, 4 Aug 2008 07:58:05 +0200 (CEST) X-IronPort-AV: E=Sophos;i="4.31,302,1215381600"; d="scan'208";a="13697745" Received: from vau06-2-82-238-190-210.fbx.proxad.net (HELO [192.168.0.3]) ([82.238.190.210]) by mail2-relais-roc.national.inria.fr with ESMTP/TLS/DHE-RSA-AES256-SHA; 04 Aug 2008 07:58:04 +0200 Message-ID: <48969A6B.5010005@sophia.inria.fr> Date: Mon, 04 Aug 2008 07:58:03 +0200 From: Yves Bertot User-Agent: Thunderbird 1.5.0.10 (Macintosh/20070221) MIME-Version: 1.0 To: Damien Guichard Cc: "caml-list@yquem.inria.fr" Subject: Re: [Caml-list] Error: This function is applied to too many arguments,maybe you forgot a `; ' References: <20080804005824.5FA4480000A0@mwinf2804.orange.fr> In-Reply-To: <20080804005824.5FA4480000A0@mwinf2804.orange.fr> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Spam: no; 0.00; ocaml:01 ocaml:01 extensively:01 caml-list:01 functions:01 functions:01 parentheses:01 parentheses:01 bertot:01 bertot:01 pair:01 int:01 argument:02 argument:02 functional:02 To be more precise, Ocaml being a functional language, any function, when applied to one argument, may return a new function which can in turn be applied to another argument. Thus if you write : (a (b)) (c), Ocaml (and most other functional programming languages), understand that a(b) is supposed to be a function, that returns another function, then applied to c. In practice, this trick is used extensively throughout functional programs, so that placing parentheses around arguments would result in a humongous number of parentheses. For this reason, a new convention for parentheses was enforced: you don't put any parentheses around function arguments, unless it is necessary for disambiguation (for instance, if you want b to be applied to c, and you don't place parentheses around the function part, so that (a(b))(c) is simply written a b c This means : a applied to b, and then to c, Now, if you want "a applied to the result of applying b to c", you write a (b c) Please note there are no parentheses around c. In practice, most functions taking several arguments are described in this manner, instead of being described as function taking a pair as argument. This is known as "currification" because Curry was one of the early mathematicians to advocate the idea that mathematics (and programming) could be described with only one-argument functions. In your case, both print_int and fac are one argument functions, as can be seen from their type. Yves 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.7 required=5.0 tests=AWL,SPF_FAIL autolearn=disabled version=3.1.3 X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from mail1-relais-roc.national.inria.fr (mail1-relais-roc.national.inria.fr [192.134.164.82]) by yquem.inria.fr (Postfix) with ESMTP id E0CE8BBB7 for ; Tue, 5 Aug 2008 14:33:03 +0200 (CEST) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AhAJAG/gl0hQRFuwgGdsb2JhbACKc4ZFAQEQnGQ X-IronPort-AV: E=Sophos;i="4.31,310,1215381600"; d="scan'208";a="15821010" Received: from furbychan.cocan.org ([80.68.91.176]) by mail1-smtp-roc.national.inria.fr with ESMTP/TLS/AES256-SHA; 05 Aug 2008 14:11:43 +0200 Received: from rich by furbychan.cocan.org with local (Exim 4.63) (envelope-from ) id 1KQLO8-0006lm-T4; Tue, 05 Aug 2008 13:11:41 +0100 Date: Tue, 5 Aug 2008 13:11:40 +0100 To: Ben Aurel Cc: caml-list@yquem.inria.fr Subject: Re: [Caml-list] Error: This function is applied to too many arguments, maybe you forgot a `; ' Message-ID: <20080805121140.GA25452@annexia.org> References: <74a4f4670808031746pe6b1fbfx2be16927392a693f@mail.gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <74a4f4670808031746pe6b1fbfx2be16927392a693f@mail.gmail.com> User-Agent: Mutt/1.5.13 (2006-08-11) From: Richard Jones X-Spam: no; 0.00; wrote:01 caml-list:01 int:01 applied:05 arguments:07 red:92 function:08 aug:10 maybe:10 error:12 print:13 www:84 too:17 forgot:19 2008:19 On Sun, Aug 03, 2008 at 08:46:32PM -0400, Ben Aurel wrote: > print_int fac(6);; Read this: http://www.ocaml-tutorial.org/the_basics Rich. -- Richard Jones Red Hat 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.7 required=5.0 tests=AWL,DNS_FROM_RFC_POST, SPF_NEUTRAL,UPPERCASE_25_50 autolearn=disabled version=3.1.3 X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from mail3-relais-sop.national.inria.fr (mail3-relais-sop.national.inria.fr [192.134.164.104]) by yquem.inria.fr (Postfix) with ESMTP id 9BE42BBAF for ; Tue, 5 Aug 2008 15:29:50 +0200 (CEST) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AkoBAEDyl0hA6aazlGdsb2JhbACQfD4BAQEBCQMKBxEDlwCFbQ X-IronPort-AV: E=Sophos;i="4.31,310,1215381600"; d="scan'208";a="15738356" Received: from py-out-1112.google.com ([64.233.166.179]) by mail3-smtp-sop.national.inria.fr with ESMTP; 05 Aug 2008 15:29:49 +0200 Received: by py-out-1112.google.com with SMTP id a77so1166351pyh.33 for ; Tue, 05 Aug 2008 06:29:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:from:reply-to:to:subject:date :user-agent:cc:references:in-reply-to:content-type :content-transfer-encoding:content-disposition:message-id; bh=agUYZARTBx+aqo2vYfn2cPuf4sw1U+9H/hyYmiQye1Q=; b=XARkAuiALmRjffO97KObxw5r/38Bb692OjENjFier4kFqrzNAzZZk1Sb00OZJOyvsx BlpVBT3cI9TXVDEHAH7RfSsEdaukukt9vhBrACB3dZBmqzeKIvLXBWT8clSlbQ+aPlVX /hWCF9rX8ABj1JWeseUplBU1I/KDIEOlhvXjU= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=from:reply-to:to:subject:date:user-agent:cc:references:in-reply-to :content-type:content-transfer-encoding:content-disposition :message-id; b=mcwhcRWWm/nFtEP+lxfgvEjvsB/B1HW9xEywi39AzWFDZvzNX9sSPzqGxPhq6K0YNB x5/06DCRdOI7vavqgwy76hdkNaRF85Ysmp93jx7usxbozLM74msJfqfFo8ocfMdO4yrL yZ/N73Jdrt+AlF8sghCEGqTb8raT3wKGhpLC4= Received: by 10.115.49.11 with SMTP id b11mr15421127wak.117.1217942987703; Tue, 05 Aug 2008 06:29:47 -0700 (PDT) Received: from lawn-143-215-204-204.lawn.gatech.edu ( [143.215.204.204]) by mx.google.com with ESMTPS id 34sm2260651yxm.0.2008.08.05.06.29.46 (version=TLSv1/SSLv3 cipher=RC4-MD5); Tue, 05 Aug 2008 06:29:47 -0700 (PDT) From: Peng Zang Reply-To: peng.zang@gmail.com To: caml-list@yquem.inria.fr Subject: Re: [Caml-list] Error: This function is applied to too many arguments, maybe you forgot a `; ' Date: Tue, 5 Aug 2008 09:29:38 -0400 User-Agent: KMail/1.9.7 Cc: Ben Aurel References: <74a4f4670808031746pe6b1fbfx2be16927392a693f@mail.gmail.com> <20080805121140.GA25452@annexia.org> In-Reply-To: <20080805121140.GA25452@annexia.org> Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200808050929.45237.peng.zang@gmail.com> X-Spam: no; 0.00; hash:01 peng:98 peng:98 wrote:01 wrote:01 caml-list:01 int:01 chapters:02 gnu:03 caltech:05 applied:05 message-----:05 pgp:05 pgp:05 linux:07 -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On Tuesday 05 August 2008 08:11:40 am Richard Jones wrote: > On Sun, Aug 03, 2008 at 08:46:32PM -0400, Ben Aurel wrote: > > print_int fac(6);; > > Read this: http://www.ocaml-tutorial.org/the_basics > > Rich. Second that. You really should take a look at that. Also, this is a great resource as well: http://www.cs.caltech.edu/courses/cs134/cs134b/book.pdf You can read that online or print out chapters for offline reading. Peng -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.7 (GNU/Linux) iD8DBQFImFXJfIRcEFL/JewRApGmAKDQtoGMfsFjSvvWuXblp/wRVEBOMgCgtsD2 gIoUYouoTrXnTTrUTBSWyxA= =HtfJ -----END PGP SIGNATURE-----