小编use*_*728的帖子

尾递归和迭代SML

这是我的任务.

(http://prnt.sc/aa3gwd)

我一直在和导师一起工作,这是我们迄今为止所提出的.

fun mult(a,b) =
  let
    val product = 0
in
    if (a = 0) then 
0
   else
     while a > 0 do
     (                  
       product := product + b;  
       if (a = 1) then 
  product
else
          a:= a -1
     );       
end;
; //the function did not run at end;, so we added these two semicolons below
;
Run Code Online (Sandbox Code Playgroud)

输出是:

stdIn:102.11-103.6 Error: syntax error: deleting  SEMICOLON END SEMICOLON
Run Code Online (Sandbox Code Playgroud)

在过去的两周里我才被介绍给SML而且我无法理解它.很感谢任何形式的帮助.

iteration translation tail-recursion sml translate

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

标签 统计

iteration ×1

sml ×1

tail-recursion ×1

translate ×1

translation ×1