I would like to write a minimal function with an internal state.
It should have signature f: () -> ()
and the n-th time it is called should print the number n.
I imagine that refs are necessary, but I do not know how to use them to make such a function.