I have a recursive function in SML that does a certain computation that doesn't really matter for my question. What I want to do is I want to track the number of times the recursion has taken place, as in I want to count the iterations of my algorithm. I know if for example I declared:
val counter = 0; val counter = counter + 1;
The other counter is a different variable. It is not the same one incremented by one. So this type of incrementing will lose its scope in one recursive call.
Is there any way I can keep track?