GitPedia

Gen

Simple, efficient iterators for OCaml

From c-cube·Updated March 18, 2026·View on GitHub·

Iterators for OCaml, both restartable and consumable. The implementation keeps a good balance between simplicity and performance. The project is written primarily in OCaml, distributed under the BSD 2-Clause "Simplified" License license, first published in 2014. Key topics include: gen, generator, iterator, ocaml.

Latest release: v1.11.1
March 16, 2023View Changelog →

Gen build

Iterators for OCaml, both restartable and consumable. The implementation
keeps a good balance between simplicity and performance.

The library is extensively tested using qtest. If you find a bug,
please report!

The documentation can be found here
the main module is Gen
and should suffice for 95% of use cases.

Changelog

Native install

Installation in a native OCaml project, via opam:

sh
$ opam install gen

or, manually, by building the library and running make install. Opam is
recommended, for it keeps the library up-to-date.

BuckleScript install

Installation in JavaScript, via BuckleScript,
in an npm project:

  1. Install this package:

    sh
    $ npm install bs-gen
  2. Manually add bs-gen to your bsconfig.json's bs-dependencies:

    json
    "bs-dependencies": [ ... "bs-gen" ],

Use

You can either build and install the library (see "Build"), or just copy
files to your own project. The last solution has the benefits that you
don't have additional dependencies nor build complications (and it may enable
more inlining).

If you have comments, requests, or bugfixes, please share them! :-)

Build

There are no dependencies except for dune for building. This should work with OCaml>=4.02

sh
$ make

To build and run tests (requires oUnit and qtest):

sh
$ opam install oUnit qtest $ make test

License

This code is free, under the BSD license.

Contributors

Showing top 7 contributors by commit count.

View all contributors on GitHub →

This article is auto-generated from c-cube/gen via the GitHub API.Last fetched: 6/25/2026