Build your own lazy operation evaluator


I’m always fascinated by how Elixir’s Stream module handles operations lazily by storing them in a struct.

It’s so simple but so brilliant! 🤯

So, I wanted to see what it’d be like to write a simple implementation of a lazy math evaluator.

Unsurprisingly, Elixir makes it really easy to do this.

Of course, the Stream module handles things more generically by taking functions instead of my simple values. But the idea is the same!

Hope you like it!

Want the latest Elixir Streams in your inbox?

    No spam. Unsubscribe any time.