List.make not tail-recursive
ygrek opened this issue · 1 comments
ygrek commented
Originally reported on Google Code with ID 12
# List.make 10000000 1;;
Stack overflow during evaluation (looping recursion?).
# let make i x =
let rec loop acc x = function
| 0 -> acc
| i -> loop (x::acc) x (i-1)
in loop [] x i;;
val make : int -> 'a -> 'a list = <fun>
# make 10000000 1;;
- : int list =
[1; 1; 1; 1; 1; 1; 1; 1; 1; ...]
Reported by apsheronets
on 2009-09-07 13:42:11
ygrek commented
Fixed in r383, thanks
Reported by ygrekheretix
on 2011-03-06 13:42:18
- Status changed:
Fixed