streams

Iterator-chaining library implementing common functional programming patterns such as `map`, `filter`, and `reduce`

$ luarocks install streams

This library provides a Java-like `Stream` class that provides a fluent interface of lazily-computed and chainable iterator operations such as `map`, `filter`, and `reduce`. For example:

```lua
local fn = require "stream"
fn.stream{2, 3, 4, 7}
:filter(function(x) return x % 2 == 0 end)
:map(function(x) return x ^ 2 end)
:collect() -- {4, 16}
```

Versions

v1.0.013 days ago1 download

Dependencies

lua >= 5.1

Manifests