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

_.permutation and _.combination support for arrays #47

Open
bdkent opened this issue Dec 3, 2015 · 13 comments
Open

_.permutation and _.combination support for arrays #47

bdkent opened this issue Dec 3, 2015 · 13 comments

Comments

@bdkent
Copy link

bdkent commented Dec 3, 2015

It would be really useful to support the standard permutation/combination functions on arrays.

Something like:

_.permutations([0, 1], ['a', 'b']) => [ [0, 'a'], [0, 'b'], [1, 'a'], [1, 'b'] ];
_.combinations([1, 2, 3, 4], 2) => [ [1, 2], [1, 3], [1, 4], [2, 3], [2, 4], [3, 4] ];

These additions have already (and I think unfortunately) been rejected from lodash proper:
lodash/lodash#1191
lodash/lodash#1032

I very frequently find the need for them, so I think they belong in lodash-contrib.

Thanks!

@refack
Copy link
Member

refack commented Dec 3, 2015

Accepted as an enhancement. Do you have a PR for this?

@jdalton
Copy link
Contributor

jdalton commented Dec 3, 2015

@bdkent You should also 👍 the lodash issues.
This helps me keep tabs on user demand for such methods.

@mathpere
Copy link

👍

1 similar comment
@frostme
Copy link

frostme commented Feb 21, 2016

👍

@wassname
Copy link

wassname commented Apr 2, 2016

Here is an implementation for arrays strings and object. It's similar to pythons itertools.product.

Let me know if you want me to make it a PR (and which category it fits into?).

@ericmarkmartin
Copy link

👍

@TWiStErRob
Copy link

Long-standing...

@o0x2a
Copy link

o0x2a commented Dec 6, 2017

👍

wassname added a commit to wassname/lodash-contrib that referenced this issue Dec 7, 2017
@devhyunjae
Copy link

👍 Any updates in here?

@wassname
Copy link

wassname commented Dec 9, 2019

I made this into a PR see #56

@electic
Copy link

electic commented Mar 22, 2021

Any plans to merge this?

@carafelix
Copy link

merge please

@refack
Copy link
Member

refack commented Apr 12, 2024

Good time to do some housekeeping on this repo 😄
Expect a resolution in the coming days.

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