caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* Re: [Caml-list] Error: This function is applied to too many arguments,maybe you forgot a `; '
@ 2008-08-04  1:00 Damien Guichard
  2008-08-04  5:58 ` Yves Bertot
  0 siblings, 1 reply; 4+ messages in thread
From: Damien Guichard @ 2008-08-04  1:00 UTC (permalink / raw)
  To: caml-list

[-- Attachment #1: Type: text/plain, Size: 1353 bytes --]

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

[-- Attachment #2: Type: text/html, Size: 3012 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread
* Error: This function is applied to too many arguments, maybe you forgot a `;'
@ 2008-08-04  0:46 Ben Aurel
  2008-08-05 12:11 ` [Caml-list] Error: This function is applied to too many arguments, maybe you forgot a `; ' Richard Jones
  0 siblings, 1 reply; 4+ messages in thread
From: Ben Aurel @ 2008-08-04  0:46 UTC (permalink / raw)
  To: caml-list

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


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2008-08-05 13:29 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-08-04  1:00 [Caml-list] Error: This function is applied to too many arguments,maybe you forgot a `; ' Damien Guichard
2008-08-04  5:58 ` Yves Bertot
  -- strict thread matches above, loose matches on Subject: below --
2008-08-04  0:46 Error: This function is applied to too many arguments, maybe you forgot a `;' Ben Aurel
2008-08-05 12:11 ` [Caml-list] Error: This function is applied to too many arguments, maybe you forgot a `; ' Richard Jones
2008-08-05 13:29   ` Peng Zang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).