Wiki

Clone wiki

dart_trotter / amalgams

Home | Permutations | Combinations | Amalgams | Compositions | Subsets | Compounds | Inverses | About

Amalgams

The Amalgams constructor accepts two arguments: the number of items to take from a set and a list containing the items in the set.

For example, the following line creates a pseudo-list containing all the 3-amalgams of the strings "a" to "e".

var a = new Amalgams(3, characters("abcde"));

To see how many amalgams are "contained" in a, we can check a.length. We can retrieve the individual amalgams by index, e.g., a[0].

How are Amalgams arranged?

In this library, Amalgams are arrangements of items taken from a set for which:

  • Order is important.
  • Items are replaced.

For example, consider the following set of trotters:

There are 125 3-amalgams of trotters taken from this set. They are arranged by the algorithm as follows:

(dot, dot, dot)

Updated