let fib count = let rec f length accum = if length < count then match accum with x :: y :: xs -> f (length+1) ((x+y) :: accum) | [x] -> failwith "local 'f' called but accum only has one starting element" | [] -> failwith "local 'f' called but accum is empty" else accum in f 2 [1; 0] ;; let main () = fib 10 ;; let _ = main ()