function seq should return a sequence starting from init and at each time extends by step untill the condition is not verified:
let rec seq init step cond () =
let r = ref init in
if cond !r
then Cons(step !r, seq !r step cond)
else Nil
i tried these (to_list (seq 1 seq 1 (fun x -> x+1) (fun x -> x <10)) and i have Stack overflow during evaluation (looping recursion?).
ris never updatedlet rec seq init step cond ()? why not simplylet rec seq init step cond?