Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/laravel/10.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ocaml 递归没有按预期工作_Ocaml - Fatal编程技术网

Ocaml 递归没有按预期工作

Ocaml 递归没有按预期工作,ocaml,Ocaml,keword rec不执行任何操作,也不会导致任何分段错误 比如这个例子 let rec x x=x+x in x 2;; :-int=2 在这一定义中: let rec x x = x + x “递归”函数名x被名为x的参数隐藏。就好像你有: let rec x y = let x = y in x + x 本质上,存在一个隐藏递归绑定的内部绑定

keword rec不执行任何操作,也不会导致任何分段错误 比如这个例子

 let rec x x=x+x in x 2;;
 :-int=2
在这一定义中:

let rec x x = x + x
“递归”函数名
x
被名为
x
的参数隐藏。就好像你有:

let rec x y = let x = y in x + x
本质上,存在一个隐藏递归绑定的内部绑定