I'm new to F# and have some compilation problems in this code fragment:
let rec mywhile p f s =
if p s then s
else
let s1 = f s
mywhile p f s1
let eps = 0.001
let dichotomy f a b =
let out (a, b) = a
let c a b = (a + b) / 2.
out (mywhile (fun (a, b) -> a - b < eps)
(fun (a, b) -> if f c * f a < 0 then (a, c) else (c, b))
(a, b))
In particular, here: a - b < eps, then (a, c)
Expecting a type supporting the operator '-' but given a function type. You may be missing an argument to a function.
Aucun commentaire:
Enregistrer un commentaire