I have two functions that rely on each other heavily. Each one must use the other one in order to perform the desired task.
I used the and
operator in SML when I used them.
The problem is that I am required to hide every single function that is not the main one. I was taught to use local
in order to perform this but I never reached this situation, I can't understand how something like this will work syntax wise.
I am referring to something like this:
local
f()
in
g()
end;
Is there any way to do this?
You need a third "main" function to start things off – your local f
can't be mutually recursive with g
.
Like this:
local
fun f x = something with g
and g x = something with f
in
fun h x = whatever
end