diff options
| author | Pierre-Marie Pédrot | 2014-07-03 17:45:06 +0200 |
|---|---|---|
| committer | Pierre-Marie Pédrot | 2014-07-03 17:45:06 +0200 |
| commit | c892f8cab37c0a89f6975e6a14bebad4d86156bd (patch) | |
| tree | c599bb1bafa4841b7a8ad539a83f4103413d4d10 /lib/iStream.ml | |
| parent | b17fb013f1810106b8cd88a12a2df3f26dc7c289 (diff) | |
Adding a coiterator to IStream.
Diffstat (limited to 'lib/iStream.ml')
| -rw-r--r-- | lib/iStream.ml | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/lib/iStream.ml b/lib/iStream.ml index da54d9f7b8..36b9c43ad0 100644 --- a/lib/iStream.ml +++ b/lib/iStream.ml @@ -20,6 +20,12 @@ let cons x s = Lazy.lazy_from_val (Cons (x, s)) let thunk = Lazy.lazy_from_fun +let rec make_node f s = match f s with +| Nil -> Nil +| Cons (x, s) -> Cons (x, make f s) + +and make f s = lazy (make_node f s) + let rec force s = match Lazy.force s with | Nil -> () | Cons (_, s) -> force s |
