Last active
August 29, 2015 14:02
-
-
Save plumhead/9ac80e348c2c4533b761 to your computer and use it in GitHub Desktop.
FSharp Fib Pipeline
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/// Fibonacci Number formula | |
let rec fib n = | |
match n with | |
| 0 | 1 -> n | |
| _ -> fib (n - 1) + fib (n - 2) | |
// Print even fibs | |
[1 .. 10] | |
|> List.map fib | |
|> List.filter (fun n -> (n % 2) = 0) | |
|> printList | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment