caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Jean-Baptiste Rouquier <jrouquie@ens-lyon.fr>
To: Holger Schulz <qdl@gmx.net>
Cc: caml-list@pauillac.inria.fr
Subject: Re: [Caml-list] OCaml error message
Date: Mon, 03 May 2004 20:38:03 +0200	[thread overview]
Message-ID: <4096918B.6060508@ens-lyon.fr> (raw)
In-Reply-To: <14600.1083608359@www62.gmx.net>

Replace "div" with "/".

By the way, you don't need to write the types of the functions : just write
  let rec ggT (x,y) =
    if y = 0 then x
    else ggT (y, x mod y)
and rely on type inference.
There is also a beginer's list : 
http://groups.yahoo.com/group/ocaml_beginners/.
Regards,

Jean-Baptiste Rouquier
http://perso.ens-lyon.fr/jean-baptiste.rouquier


>---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?
>
>---cut--
># #use "B2A3.ml";;
>type rat = int * int
>exception Denominator_Zero
>val ggT : int * int -> int = <fun>
>val kgV : int * int -> int = <fun>
>File "B2A3.ml", line 10, characters 29-30:
>This expression is not a function, it cannot be applied
>---cut---
>

-------------------
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


  reply	other threads:[~2004-05-03 18:37 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-05-03 18:19 Holger Schulz
2004-05-03 18:38 ` Jean-Baptiste Rouquier [this message]
2004-05-03 18:42 ` Matt Gushee
2004-05-03 18:19 Holger Schulz

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4096918B.6060508@ens-lyon.fr \
    --to=jrouquie@ens-lyon.fr \
    --cc=caml-list@pauillac.inria.fr \
    --cc=qdl@gmx.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).