(** * fib.ml * compile with: ocamlopt nums.cmxa fib.ml -o fib * ./fib 500 * prints the first 500 Fibonacci numbers *) open Num;; let max = num_of_string Sys.argv.(1);; let one = num_of_int 1;; let zero = num_of_int 0;; let a = ref zero;; let b = ref one;; let index = ref zero;; while(le_num !index max) do print_endline ((string_of_num !index)^"\t"^(string_of_num !a)); let c = !a +/ !b in ( a:= !b; b:= c; index := succ_num !index; ) done