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

Move combinations, permutations, etc., from Array to Indexable #10235

Merged
merged 2 commits into from
Jan 12, 2021

Conversation

wonderix
Copy link
Contributor

@wonderix wonderix commented Jan 10, 2021

I tried to implement #10063 to help judging if it's feasible.

Moving Array.product to Indexable made no sense to me. Therefore it was also not possible to move Array#repeated_permutations to Indexable

Fixes #10063

src/indexable.cr Outdated
# a.sample(2) # => [2, 1]
# a.sample(2, Random.new(1)) # => [1, 3]
# ```
def sample(n : Int, random = Random::DEFAULT)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

#sample is already covered by #10129.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I reverted the changes for sample

@HertzDevil
Copy link
Contributor

#repeated_permutations can be implemented on top of #10013.

src/indexable.cr Outdated Show resolved Hide resolved
Co-authored-by: Quinton Miller <nicetas.c@gmail.com>
@asterite asterite added this to the 1.0.0 milestone Jan 12, 2021
@asterite
Copy link
Member

@wonderix This is great, thank you!

@asterite asterite merged commit 153b5d2 into crystal-lang:master Jan 12, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[RFC] Move combinations, permutations, etc., from Array to Indexable
4 participants