I'm trying to draw fractal: for every circle displeyed I want to draw circle half it's size to the left and right of that circle. Here is my code:
let rec drawCircle x y r =
let halfSize = r/2 in
draw_circle x y r;
drawCircle (x+r) y halfSize;
drawCircle (x-r) y halfSize;;
It compiles but when I run it I get stack overflow. The question is why and how can I fix it in this function ?
drawCirclein the body of the function, withdraw_circle.