小编may*_*aya的帖子

迭代器,枚举和序列之间的区别

我想了解ocaml中迭代器,枚举和序列之间的区别

enumeration:
type 'a t = {
  mutable count : unit -> int; (** Return the number of remaining elements       in the enumeration. *)
  mutable next  : unit -> 'a;  (** Return the next element of the   enumeration or raise [No_more_elements].*)
  mutable clone : unit -> 'a t;(** Return a copy of the enumeration. *)
  mutable fast  : bool;        (** [true] if [count] can be done without reading all elements, [false] otherwise.*)
}
sequence:

type 'a node =
| Nil …
Run Code Online (Sandbox Code Playgroud)

ocaml

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

Scala解析错误';' 预期,但字符串文字发现

这些解析有什么问题?

def role : Parser[Role] = ~> protocolID <~ "(" ~> roleName <~ ")" ~ "{" ~>      statements <~ "}" ^^ {
Run Code Online (Sandbox Code Playgroud)

它在第一个括号中返回错误:';' 预期,但字符串文字发现.

谢谢,

scala

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

标签 统计

ocaml ×1

scala ×1