less-docs icon indicating copy to clipboard operation
less-docs copied to clipboard

Permutation of 4 is 24, not 16

Open meetilaiya opened this issue 2 years ago • 1 comments

Issue: Permutation of 4 is 24, not 16.

Document link: https://github.com/less/less-docs/blob/484055f839c15aba1ec660fc1e068984c3dccef6/content/features/parent-selectors.md

Document lines: & can also be used to generate every possible permutation of selectors in a comma separated list: p, a, ul, li { .... } This expands to all possible (16) combinations of the specified elements:

The above document lines say permutation of 4(p,a,ul,li) is 16 which i think is not correct.

Proposal: Instead of using the word "permutation", we can use something else. My suggestion would be to frame the sentence to something like "& can also be used to generate every possible combination of selectors in a comma-separated list:" and "This expands to all possible combinations of the specified elements:"

meetilaiya avatar Jul 27 '21 07:07 meetilaiya

Permutation and combination are both concepts in mathematics that deal with the arrangement and selection of objects. The main difference between them lies in whether the order of the objects matters or not.

Permutation: In permutations, the order of arrangement matters. It refers to the different ways in which a set of objects can be arranged or ordered. The number of permutations of a set of objects is often denoted as "nPr" (n P r), where "n" represents the total number of objects, and "r" represents the number of objects being arranged or selected.

Let's consider a simple example: You have three books on a shelf: Book A, Book B, and Book C. Now, let's say you want to arrange these books in a specific order on the shelf. The possible permutations would be:

  1. Book A, Book B, Book C
  2. Book A, Book C, Book B
  3. Book B, Book A, Book C
  4. Book B, Book C, Book A
  5. Book C, Book A, Book B
  6. Book C, Book B, Book A

In this case, since the order matters, each arrangement is considered a different permutation.

Combination: In combinations, the order of arrangement does not matter. It refers to the different ways in which a selection of objects can be made from a larger set, without regard to the order of the selected objects. The number of combinations of a set of objects is often denoted as "nCr" (n C r).

Let's continue with our previous example of three books: Book A, Book B, and Book C. Now, let's say you want to select two books from the three to take with you. The possible combinations would be:

  1. Book A, Book B
  2. Book A, Book C
  3. Book B, Book C

In this case, the order of the books does not matter, so each combination is considered the same even if the books are listed in a different order.

The key difference between permutations and combinations is whether the order matters. Permutations focus on the arrangement of objects where the order is essential, while combinations focus on the selection of objects where the order is not important.

postmeback avatar Jun 22 '23 17:06 postmeback