Browse thread
[Caml-list] function type confusion (using let)
- Michael Leary
[
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: | Michael Leary <leary@n...> |
| Subject: | [Caml-list] function type confusion (using let) |
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
if x < -.pi then (* <------ here *)
pi2 +. x
else
x
File "fbot.ml", line 118, characters 4-52:
This expression has type float but is here used with type unit
I want normr to be float -> 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