mercredi 15 novembre 2017

Convert number to tuple (latin) name

Wikipedia defines names for tuples (multiples) of specific length (up to 31 and some significant others afterwards) at http://ift.tt/2z4qqec.

For example:

  • 1 = single
  • 2 = double
  • 3 = triple
  • 4 = quadruple
  • 5 = quintuple
  • 6 = sextuple

Is there an easy way in JavaScript (specifically Ember) to convert from a number to the named tuple. So I could do something like

console.log(numberToNamedTuple(5)); // quintuple

At the moment I am anticipating copying and pasting the list from wikipedia into an array and then writing a function to do a lookup on that. Is there an existing function I should be using instead or something I have overlooked perhaps?

Please note this question is related to the mathematic / real world definition of a tuple rather than the programming use of tuples as per python and other languages.




Aucun commentaire:

Enregistrer un commentaire