|Perl Monk, Perl Meditation|
Re^2: Faster alternative to Math::Combinatoricsby AppleFritter (Vicar)
|on Sep 02, 2017 at 19:14 UTC||Need Help??|
More answers and solutions are always good, so thanks a lot for your effort!
The reason you're getting 27 combinations is that you're producing ordered tuples, whereas what I'm looking for is multisets (which are by definition unordered). I'll quote what I wrote in my post:
What this means is that:
Wikipedia has more on multisets: Multiset.
Like I said in my reply to tybalt89, the underlying problem I was trying to solve here¹ is related to a certain class of cellular automata with multiple states. I needed to generate all the possible combinations of states a certain subset of a given cell's immediate neighborhood could be in — but I was only interested in outer-totalistic CAs where the specific alignment of those neighboring cells didn't matter. Hence: it makes a difference whether of three cells I'm considering, one is in state 2 and two in state 3, or two in state 2 and one in state 3; but it doesn't make a difference specifically where in the center cell's neighborhood those neighboring cells are. Multisets / multicombinations were a natural choice for representing that.
TL;DR — thanks again, I appreciate all the good replies, tips, pointers and suggestions I got!