相关疑难解决方法(0)

新泽西州ML的嵌套本地声明

大家好,我有这段代码:

local
 helper(f, i, j) = local
                    fun NTimesF(f, n:int) = 
                    if n = 1 then fn (x) => f(x)
                    else fn (x) => f(NTimesF(f, n - 1)(x));
                   in
                    if(i <= j) then NTimesF(f, i) :: helper(f, (i+1), j)
                    else []
                   end
in  
 fun compList f n = helper(f, 1, n);
end;
Run Code Online (Sandbox Code Playgroud)

我需要编写接收一些函数f和整数n的程序并生成函数列表,如[f1,f2,... fn] < - fn是函数的组合n次但每次收到错误时:

- stdIn:1.1-2.9 Error: syntax error: deleting  LOCAL ID LPAREN
stdIn:2.10-2.14 Error: syntax error: deleting  COMMA ID COMMA
stdIn:2.16-2.25 Error: syntax error: deleting  RPAREN …
Run Code Online (Sandbox Code Playgroud)

sml smlnj

7
推荐指数
1
解决办法
8313
查看次数

标签 统计

sml ×1

smlnj ×1