hello everyone I have this snippet of the code:
local
helper(f, i, j) = local
fun NTimesF(f, n:int) =
if n = 1 then
There are two ways to define local functions and variables in SML: local ... in ... end and let ... in ... end.
The difference between local and let is that with local what comes between in and end are one or more variable or function declarations. With let what comes between in and end is an expression.
Unlike local, let is an expression and the value of a let expression is the value of the expression between in and end.
Since in your case you have an expression between in and end (and you want the function to evaluate to the result of that expression), you need to use let, not local.