Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

implement power method #12

Closed
xgbuils opened this issue May 20, 2017 · 0 comments
Closed

implement power method #12

xgbuils opened this issue May 20, 2017 · 0 comments

Comments

@xgbuils
Copy link
Owner

xgbuils commented May 20, 2017

I would like to implement a power method that do the cartesian product of an iterable n times:

Iterum([0, 1]).power(3) /* (
    (0 0 0)
    (1 0 0)
    (0 1 0)
    (1 1 0)
    (0 0 1)
    (1 0 1)
    (0 1 1)
    (1 1 1)
) */ 

This method produces the same result like:

Iterum.product([0, 1], [0, 1], [0, 1])

However, Iterum.product cannot produce a cartesian product of infinite iterables and Iterum.power can.

Iterum([0, 1]).power(Infinity) /* (
    (0, 0, 0, 0, 0, ...)
    (1, 0, 0, 0, 0, ...)
    (0, 1, 0, 0, 0, ...)
    (1, 1, 0, 0, 0, ...)
    ...
) */
@xgbuils xgbuils added this to the release 2.0 milestone May 20, 2017
xgbuils added a commit that referenced this issue Jun 4, 2017
@xgbuils xgbuils closed this as completed Jun 4, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant