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

Using an iterator rather than a vector? #5

Open
dpaukov opened this issue Oct 8, 2014 · 2 comments
Open

Using an iterator rather than a vector? #5

dpaukov opened this issue Oct 8, 2014 · 2 comments

Comments

@dpaukov
Copy link
Owner

dpaukov commented Oct 8, 2014

From PeterVermont on December 19, 2012 23:40:45

I would like the equivalent of the Python itertools.combinations(iterable, r)

See: http://docs.python.org/2/library/itertools.html#itertools.combinations I wish to make a SimpleCombination of Integers over a range. As best as I can tell, all of your code requires generating a vector the size of the entire range which could be hundreds of thousands.

Thanks!

Original issue: http://code.google.com/p/combinatoricslib/issues/detail?id=5

@dpaukov
Copy link
Owner Author

dpaukov commented Oct 8, 2014

From PeterVermont on December 20, 2012 10:26:45

On using the library I understand better why the code is structured as it is -- given that you are going to returning the vector objects in the combinations, there is little harm in having the user create them up front. I can also use the Range factory method.

I ended up really liking this way of doing things. By changing the items I sent in my original vector I got very useful control over exactly what was iterated which eliminated costly post hoc filtering.

It still might be useful to not require a vector in which case you would return a combination just made of indices into a specified range.

@dpaukov
Copy link
Owner Author

dpaukov commented Oct 8, 2014

From d.pau...@gmail.com on January 31, 2013 05:48:58

Labels: -Type-Defect Type-Enhancement

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