Generating a list causes a stack overflow
问题 I'm generating a list of random numbers: let gen n = let rec pom l n = match n with | 0 -> l | _ -> let el = Random.int 20000000 in pom (el::l) (n-1) in pom [] n let lo = gen 1000000 What I get is Fatal error: exception Stack_overflow Why? I'm using tail recursion (and an accumulator) EDIT : You're right, the stack overflows on both sorts. But if my code had a zillion lines, it would be a pain to debug it this way. I'd like to use ocamldebug here, just as a learning experience. I ran