I wrote a tutorial on the Stream module for the Objective CAML Tutorial wiki. It’s got a lot of code that I’ve been sitting on for almost two years, so it feels good to finally get it up on the interwebs where a hard drive crash can’t hurt it.
The Stream module is not very well known, and until now has had almost no documentation. I found out a lot by studying the source while working on the PLEAC project. I also got some ideas from Raymond Hettinger’s excellent work on Python’s itertools module; Python’s generators are very similar to OCaml’s streams.
I hope to find the time to also write a tutorial on camlp4 stream expressions, which use the Stream module to implement syntax sugar that makes stream processing and parsing much more concise.
Your tutorial about the stream module was very interesting. I recently wanted to read it again but I can’t find it anymore. The site http://www.ocaml-tutorial.org/ isn’t available for a long time now (I tried several times for a few days). Do you know why ? Is there a possibility to read a copy of your tutorial on the Stream module ? Thanks again for your work.
Thanks, glad you like it! The OCaml Tutorial site is down right now due to server issues, but the folks at OCamlCore have been kind enough to put up a mirror. The tutorial site is mirrored here:
http://mirror.ocamlcore.org/ocaml-tutorial.org/index.html
and the Streams chapters are here:
http://mirror.ocamlcore.org/ocaml-tutorial.org/streams.html
http://mirror.ocamlcore.org/ocaml-tutorial.org/stream_expressions.html
Thanks!
Dave