找不到List.fold_left [英] Cannot find List.fold_left

查看:97
本文介绍了找不到List.fold_left的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在探索F#中的褶皱,并阅读了这篇文章-

I'm exploring folds in F# and read this article - Mastering F# Lists.

在本文中,它指的是.fold_left和.fold_right,并且在文本中有这些功能的示例.

In the article it refers to .fold_left and .fold_right and there are examples of these functions in that text.

但是在F#Interactive中,我只能看到List.fold-其他两个引发错误:

However in F# Interactive I can only see List.fold - the other two elicit errors:

"stdin(26,6):错误FS0039:值,构造函数,名称空间或类型'fold_left'未定义"

"stdin(26,6): error FS0039: The value, constructor, namespace or type 'fold_left' is not defined"

我必须先在某个程序集或某物上添加一个引用,然后才能使用它吗?

Must I add a ref to some assembly or something before I can use this?

Cap'n

推荐答案

F#正在开发中.在2.0版之前的版本中,库函数命名中存在某些不一致之处,例如为不同的集合类型命名.从左折起以获取序列具有名称Seq.fold的顺序,但对于列表则为List.fold_left.发布版本时 2.0的库函数很少,在所有集合中均被重命名,因此对于列表 fold_left 的名称已更改为 fold fold_right -转到后退.检查 MSDN F#列表模块说明对于当前名称,与克里斯·史密斯(Chris Smith)在2008年撰写引用的文章时相比,您可能会发现库函数的其他重命名.
F# is developing. Prior version 2.0 certain inconsistencies had place in the library function naming for different collection types, e.g. fold from left for sequences had name Seq.fold, but for lists - List.fold_left. Upon release of version 2.0 few library functions where renamed uniformly across all collections, so for Lists fold_left name was changed to simply fold and fold_right - to foldBack. Check MSDN F# List Module description for current names, you may spot few other renames of library functions compared with ones circa 2008 when Chris Smith wrote the cited article.


这篇关于找不到List.fold_left的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆