Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/haskell/8.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
为什么在F#Interactive中打印5000个数字会导致StackOverflowException?_F#_F# Interactive - Fatal编程技术网

为什么在F#Interactive中打印5000个数字会导致StackOverflowException?

为什么在F#Interactive中打印5000个数字会导致StackOverflowException?,f#,f#-interactive,F#,F# Interactive,在Windows7上的F#3.1上测试 fsi.PrintLength我认为这是中的一个bug,它负责将漂亮的打印输出到F#Interactive 有一些非尾部递归函数使用PrintLength,例如本例中的boundedInfoldl。实际上,的实现不是尾部递归的: let boundedUnfoldL (itemL : 'a -> layout) (project : 'z -> ('a * 'z) op

在Windows7上的F#3.1上测试


fsi.PrintLength我认为这是中的一个bug,它负责将漂亮的打印输出到F#Interactive

有一些非尾部递归函数使用
PrintLength
,例如本例中的
boundedInfoldl
。实际上,的实现不是尾部递归的:

let boundedUnfoldL
                (itemL     : 'a -> layout)
                (project   : 'z -> ('a * 'z) option)
                (stopShort : 'z -> bool)
                (z : 'z)
                maxLength =
      let rec consume n z =
        if stopShort z then [wordL "..."] else
        match project z with
          | None       -> []  // exhaused input 
          | Some (x,z) -> if n<=0 then [wordL "..."]               // hit print_length limit 
                                  else itemL x :: consume (n-1) z  // cons recursive... 
      consume maxLength z  
让boundednfoll
(项目L:'a->布局)
(项目:'z->('a*'z)选项)
(stopShort:'z->bool)
(z:'z)
最大长度=
让rec消耗nz=
如果停止短z,则[wordL”…]否则
将项目z与
|无->[]//未使用的输入
|一些(x,z)->如果n 5000成功

您可以将此作为错误报告给。

听起来F#Interactive可能会受益于他们在F#4.0中修复了它?