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

Implemented iterator for partitions #3

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

jacksonhenry3
Copy link

Summary:

This pull request impls the iterator trait for the Partitions struct so it can be used as an iterator directly.

Description:

  • Added an iterator implementation to the Partitions struct.
  • The iterator yields Vec<usize>, where each vec represents a partition.

Testing:

Tested against the existing oeis test case, ensuring that the iterator still yields the expected partitions for the first few entries of A000041.

@colt-browning
Copy link
Contributor

Win in usability, but loss in performance: this implementation allocates a new vector at each iteration.
(Just pointing this out, not implying that this is good or bad.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants