Hi, first of all, thanks a lot for building this awesome lib.
I was almost going to implement my own, but I found this and it suits my needs almost perfectly.
The implementation of most functions in this lib is lazy and that's really a good design choice because combinatorics are things just bound to explode in size. However, being forced to consume them in while loops feels a bit outdated.
Hi, first of all, thanks a lot for building this awesome lib. I was almost going to implement my own, but I found this and it suits my needs almost perfectly.
The implementation of most functions in this lib is lazy and that's really a good design choice because combinatorics are things just bound to explode in size. However, being forced to consume them in
while
loops feels a bit outdated.You are probably aware, but JavaScript Generators gives us a more native way of expressing lazy behavior.
I wrote some tiny wrappers around the functions this lib exposes, such as:
This way, I can consume it with a
for..of
loop:Or could even use the spread operator to turn it into an array:
Maybe this could be made built-in. If you are willing to give this a try, I could work on a PR as soon as I have some time off.