(我使用的是 SML/NJ)
列表结构http://sml-family.org/Basis/list.html包括 @、hd、tl、null、concat 等
其中一些无需前缀即可使用:@、hd、tl、[]、concat。 但其他的,例如exists 和nth 需要List 前缀。见下文:
Standard ML of New Jersey v110.79 [built: Tue Aug 8 23:21:20 2017]
- op @;
val it = fn : 'a list * 'a list -> 'a list
- concat;
val it = fn : string list -> string
- nth;
stdIn:3.1-3.4 Error: unbound variable or constructor: nth
- exists;
stdIn:1.2-2.1 Error: unbound variable or constructor: exists
- List.nth;
[autoloading]
[library $SMLNJ-BASIS/basis.cm is stable]
[library $SMLNJ-BASIS/(basis.cm):basis-common.cm is stable]
[autoloading done]
val it = fn : 'a list * int -> 'a
- List.exists;
val it = fn : ('a -> bool) -> 'a list -> bool
为什么?我试图在“标准机器学习的定义(1997)”中找到答案
但我找不到任何与此相关的内容。
最佳答案
某些名称可以不经过限定,因为它们也绑定(bind)在 SML Basis 库的顶级环境中,包括您列出的名称。请参阅here获取完整列表。
关于sml - 为什么List结构中有些函数需要 "List"前缀而有些则不需要?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52395716/