Talk:Permutations with some identical elements

From Rosetta Code

Duplicate of Permutations with repetitions

Seems to me this exact operation is covered by the existing (for 6 years!) Permutations_with_repetitions task. --Thundergnat (talk) 19:32, 25 July 2019 (UTC)

I don't think so.He wants to create the permutation of different elements in which each element has its own constant multiplicity in this permutation. His example: [2,1] ( element 1 two times und element 2 1 time ) should give results (1,1,2), (1,2,1) and (2,1,1)

Horst.h

I don't think the permutations_with_repetitions task is about permutations at all, but rather generating all possible sequences (words) of a certain length from an alphabet, where each symbol may be repeated an infinite amount of times as needed.

This task is instead about creating all sequences of a finite set of elements where some elements are indistinguishable from each other.

Yes, you're right; it is different. I've added a Go solution --PureFox (talk) 21:27, 25 July 2019 (UTC)


task wording

Where it says:

   Given an input of the form [a1, a2, ..., ak] where ai denotes how many duplicates of element i you should have, 
   each ai > 0 and the sum of all ai is n.

would it be better with:

   Given an input of the form   [a1, a2, ..., ak]   where   ak   denotes how many duplicates of element   k   you should have, 
   each   ak > 0   and the sum of all   ak   is   n.


(I've added whitespace and used a bigger font to make the subscripts easier to read.)     -- Gerard Schildberger (talk) 03:51, 27 July 2019 (UTC)

That is excellent! --Tobega
It's not the first time I notice your... "creative" vision of typography. And, I'm sorry to have to tell it to you, but I think it's hideous and it certainly does not help reading: the eye is trained to read text without extraneous spaces, without font size variations. Only on Rosetta Code have I seen this systematic massacre of text. Please reconsider. Eoraptor (talk) 06:19, 10 February 2020 (UTC)
It's too bad you have such a negative opinion of using larger fonts for mathematical expressions and/or formulae.   Try visiting MathWorld™ (and other technical/math/computer science sites) where even more whitespace, larger fonts, and italics are used, not to mention much larger indentations (and more much centering) is used.   Most eyes are trained to read text that has mathematical expressions with more whitespace, not less.   Please be more respective of other people's ideas of formula/mathematical expressions and other markups, you must know that people edit things, not to massacre text, but to improve it, and you shouldn't assume that edits were made to make it hideous, in fact, it was quite the opposite.   It may not be what you like or even prefer, but other technical websites favor more whitespace and larger fonts to make it easier to read and comprehend.   This isn't the place to start with insincere apologies and negativism, with followup of a "please reconsider".   Obviously, a lot more thought was put into my suggestions than you realize.     -- Gerard Schildberger (talk) 07:00, 10 February 2020 (UTC)
Try visiting MathWorld. There is no such hideous useless spacing on MathWorld. Nor anywhere in books or on the web. Why lie when it's so easy to prove you wrong? An example maybe? Who are you trying to fool? Did you at least discuss this with the RC community before defacing the site? Eoraptor (talk) 19:23, 10 February 2020 (UTC)
You obviously didn't read or even consider this task's author (Tobega) response (above).   Just because you have a different opinion of readability, doesn't give you the right to resort to name calling and offending other people who differ from your opinion as liars.   It is this sort of toxic verbiage that can give Rosetta Code a bad name for visitors/contributors to this site.   I believe that people who hide behind pseudonyms can/will often behave and act like there're no consequences to egregious words and infantile actions.   I prefer to not have to have a discourse with someone who is so uncivil and uncourteous, and who cannot behave oneself on Rosetta Code.   I'm asking you to please have some maturity and reconsider before you post anything offensive here on this site.     -- Gerard Schildberger (talk) 23:56, 10 February 2020 (UTC)
I find it equally offensive to modify the typography systematically without asking (this task is the exception, not the rule). This kind of modification might be widely approved by the community, I don't know: I gave you my opinion, but I'd be open to another consensus, granted it's a consensus. The problem is, it should have been discussed before doing it everywhere. And as far as I can tell, you never asked. My problem is not that your opinion differ, but that you imposed it to everyone without discussing the matter beforehand. I called you a liar because you used an example to justify your edits, which obviously does not hold: either you didn't even check, either you are a liar. It's a fact. It's offensive? But it's equally offensive to have to read your fallacies. So, the situation is this: you believe your edits make the site better, and I don't. You modified the site on a large scale, and I didn't. Period.
Oh, and by the way, my name is written on my user page, and if it's not clear enough it's not difficult to find it. But I guess you didn't try, you were so occupied being "offended". Eoraptor (talk) 07:24, 11 February 2020 (UTC)

Best not to call fellow members of the community liars so quickly even if you think someone may be factually incorrect as it can very quickly sour any conversation. On the rewording, I read the original, the change, and the acceptance from the original author. I too like the change, but if I did not like it, I hope I'd try harder to make my point without using such a term as it has a lot of emotional baggage. --Paddy3118 (talk) 18:29, 11 February 2020 (UTC)

Thanks a lot for your level-headed comments, Paddy.   I was beginning to feel like a pair of brown shoes at a tuxedo party.   I would go even further, it is best to   never   call other people liars, at least, not is such a public forum.   I never thought anyone would go down that particular rabbit hole so quickly and use such spiteful and/or libelous language.   One would think that adding whitespace to a task's preamble   (and other forms of highlighting)   was akin to leprosy or some such.     -- Gerard Schildberger (talk) 22:19, 11 February 2020 (UTC)
Point taken. For the record, I strongly prefer well established typography rules. Eoraptor (talk) 18:46, 21 March 2020 (UTC)

Close to the permutations task

Note that one of the simplest algorithms to generate permutations (this one, which also appears in Knuth's TAOCP), can be trivially modified to handle this task: just replace < and > with <= and >= in nextperm.

Eoraptor (talk) 06:12, 10 February 2020 (UTC)

Thank you for mentioning this. It was just the hint I needed. :-)

I have put a description of the algorithm in the Quackery task solution. If you are able, please double check it. I have gone over it a dozen times but can't shake that nagging feeling that I might have got the "less than"s and "greater than"s muddled.
--GordonCharlton (talk) 11:58, 1 November 2022 (UTC)