Home
Insert
Update snippet 'Fibonacci sequence with fold'
Title
Description
Fibonacci nth term with fold
Source code
let fibonacci n = [|1..n|] |> Array.fold (fun (a,b) _ -> b, a + b) (0,1) |> fst
Tags
fibonacci
fold
array
fibonacci
fold
array
Author
Link
Reference NuGet packages
If your snippet has external dependencies, enter the names of NuGet packages to reference, separated by a comma (
#r
directives are not required).
Update