Write a list generator

Write a list generator

a) Write the constructor build_list that gives n first items of the recurrent series u, a being the list of the base cases of u :

let rec build_list u a n = ... ;;
val build_list : ('a list -> int -> 'a) -> 'a list -> int -> 'a list = <fun>

b) Use build_list to implement the factorial series:

let fact = ... ;;
val fact : int -> int list = <fun>

c) The Fibonacci series has the following definition:

U(0) = 0
U(1) = 1
U(n) = U(n-1) + U(n-2) if n >= 2

Use build_list to implement the Fibonacci series:

let fibo = ... ;;
val fibo : int -> int list = <fun>