有哪些OCaml库提供延迟列表处理?我正在寻找类似以下内容的东西:
type 'a lazy_list = (*'*)
| Nil
| Cons of 'a * 'a lazy_list lazy_t
let from f =
let rec gen n =
lazy
(
match f n with
| Some x ->
Cons (x, gen (n + 1))
| None ->
Nil
)
in
gen 0
希望能够与Stream
类型集成,并为回溯Camlp4解析器提供语法糖。
Lazy.t
而不是lazy_t
。 - user102008