Browse thread
RE: [Caml-list] function type confusion (using let)
- FALCON Gilles FTRD/DTL/LAN
[
Home
]
[ Index:
by date
|
by threads
]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
| Date: | -- (:) |
| From: | FALCON Gilles FTRD/DTL/LAN <gilles.falcon@r...> |
| Subject: | RE: [Caml-list] function type confusion (using let) |
-----Message d'origine-----
De : Laurent Chéno [mailto:laurent.cheno@noos.fr]
Envoyé : lundi 3 septembre 2001 07:55
À : Michael Leary
Cc : Caml-list
Objet : Re: [Caml-list] function type confusion (using let)
(* please excuse my poor english *)
> I was trying to be clever about not using ;; and minimizing my use of ;
> in
> files, and I've gone off the deep end...
>
> Why is this wrong, and how do I fix it?:
>
> let pi = 3.14159
> let pi2 = 2.0 *. pi
>
> let normr r =
> let x = mod_float r pi2 in
> if x > 0.0 then
> if x > pi then
> -.pi2 +. x
> else
> x
> else if x < 0.0 then
^ this "then" has no else !
> if x < -.pi then (* <------ here *)
> pi2 +. x
> else
> x
... else ??
You have forgotten the "else" clause : if <cond> then <expr> has
type : unit
if <cond> then <float-expr> else <float-expr> has type : float
-------------------
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ:
http://caml.inria.fr/FAQ/
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/
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr