5 people like it.

Yet another Fibonacci

In mathematics, the Fibonacci numbers or Fibonacci series or Fibonacci sequence are the numbers in the following integer sequence: [0; 1; 1; 2; 3; 5; 8; 13; 21; 34; 55; 89; 144; 233; 377; ...] http://en.wikipedia.org/wiki/Fibonacci_number

1: 
2: 
3: 
4: 
5: 
6: 
let rec fibs a b = 
    match a + b with 
    | c when c < 10000 -> c :: fibs b c 
    | _ -> [] 

let fibonacci = 0::1::1::2::(fibs 1 2) 
val fibs : a:int -> b:int -> int list

Full name: Script.fibs
val a : int
val b : int
val c : int
val fibonacci : int list

Full name: Script.fibonacci
Next Version Raw view Test code New version

More information

Link:http://fssnip.net/bT
Posted:12 years ago
Author:Tuomas Hietanen
Tags: fibonacci