有哪些提供惰性列表处理的 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 解析器的类型和语法糖集成会很好。