Skip to content

Instantly share code, notes, and snippets.

@PatrickMcDonald
Last active August 29, 2015 14:04
Show Gist options
  • Save PatrickMcDonald/5cac28af02813d5c0d93 to your computer and use it in GitHub Desktop.
Save PatrickMcDonald/5cac28af02813d5c0d93 to your computer and use it in GitHub Desktop.
Generate Fibonacci numbers
let fibs() =
let rec fibs' a b =
seq {
yield b
yield! fibs' b (a+b)
}
fibs' 1L 1L
fibs() |> Seq.take 10 |> List.ofSeq;;
fibs() |> Seq.takeWhile (fun x -> x < 10000000000L) |> List.ofSeq;;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment