I'm just starting to experiment with F# (from a C# background). I think I'm starting to get into the right way of thinking, but this code still seems pretty awkward. Is there a better (more terse) way to accoAny comments appreciated. (BTW, this is supposed to sum all even fibonacci numbers up to 4,000,000)
let rec fib x y max acc =
let z = x + y
if z < max then
if z%2=0 then
fib y z max (z + acc)
else
fib y z max acc
else
acc
let result = fib 1 2 4000000 2
printfn "%d" result