pi.vh (322B)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
[ (:puts, puts) ] | io = import :IO sum : Number^'N -> Number sum () = 0 sum (x,xs) = x + sum xs product : Number^'N -> Number product () = 1 product (x,xs) = x * product xs pi n = map ((2 /) <> f) (1..n) |> product |> (* 2) where: f : Nat -> Real f 0 = 0 f k = sqrt (2 + f k) puts <| pi 20