It's very warm. Here is an F# fibonacci sequence. I am not sure it's really good functional fu to use mutable values.
let sumUp =
seq {let fib = ref 0
let fib1 = ref 1
while true do
yield !fib + !fib1
let oldfib = !fib
fib:=!fib1
fib1:=oldfib + !fib1}
(Seq.take 20 sumUp) |> Seq.iter (fun x -> printfn "%d" x)
No comments:
Post a Comment