我想了解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) 这些解析有什么问题?
def role : Parser[Role] = ~> protocolID <~ "(" ~> roleName <~ ")" ~ "{" ~> statements <~ "}" ^^ {
Run Code Online (Sandbox Code Playgroud)
它在第一个括号中返回错误:';' 预期,但字符串文字发现.
谢谢,