17 November 2022

New word for me: "tuple"


It's always fun to learn a new word.  I encountered this one while playing Hurdle (which I find more challenging that the old Wordle).  No other entry was possible for the fourth row; the puzzle confirmed the word and moved me on to the final hurdle.

So, to the dictionaries.  Not in the OED (OED-level words are not typically in Hurdle anyway, which like Wordle uses a database of relatively common five letter words).  But it wasn't in my 1995 edition of the official Scrabble-players dictionary, which I used for decades.  

I found the word in Wiktionary, defined as a "finite sequence of terms," and found more detail in Wikibooks -
Tuples offer another way of storing multiple values in a single value. Tuples and lists have two key differences:

Tuples have a fixed number of elements (immutable); you can't cons to a tuple.
Therefore, it makes sense to use tuples when you know in advance how many values are to be stored. For example, we might want a type for storing 2D coordinates of a point. We know exactly how many values we need for each point (two – the x and y coordinates), so tuples are applicable.

The elements of a tuple do not need to be all of the same type. For instance, in a phonebook application we might want to handle the entries by crunching three values into one: the name, phone number, and the number of times we made calls. In such a case the three values won't have the same type, since the name and the phone number are strings, but contact counter will be a number, so lists wouldn't work.

Tuples are marked by parentheses with elements delimited by commas.
Now I understand.  Tuple is a word created for programming language, and is not used by normal people in the real world.  As soon as I encountered "you can't cons to a tuple" I knew I was wading into quicksand and I carefully backed out.

Note to self:  Time passes, language changes, and so does the official lexicon for Scrabble.  Maybe it's time to update the dictionary.

4 comments:

  1. My grandfather published a generalization on prime pairs in 1950s that used the term "n-tuple" to refer to collections of primes > 2. So I always thought the term was mathematic.

    ReplyDelete
    Replies
    1. I'm fairly sure that the math term `n-tuple` (being a generalization of "triple", "quadruple", "quintuple" for "n" elements,) devolved to `tuple` in programming languages. I first heard of "tuples" in the 1990s in software used at CERN for physics analysis.

      Delete
  2. I am trying to remember the etymology of the word, but it is escaping me. As you note, it comes up rapidly in programming and computing. The tuple (x,y) and (r, theta) rapidly expand to (x, y, z), (x, y, z, t) and so on, As the examples imply, there is usually an implied (and important!) ordering. (1,2) is not the same as (2,1). Programmers use a "list", but ordering is often implied in the list (such as first-come-first-served or FCFS). As far back as FORTRAN, there were forms of tuples, such as the COMPLEX data type as distinct from INTEGER, FLOAT, and DOUBLE.

    As a guess, "tuple" is a derivative of "multiple". Emphasis on guess.

    ReplyDelete
  3. So people who code for a living are not "normal people in the real world"!? I feel so devalued!

    I don't know where or when it was coined, but it has been used in mathematics for a long time. Since the creation and manipulation of lists of elements is so central to much of computer programming, the term is also used widely in coding contexts. And because programming has become such a successful profession, more people are exposed to its concepts, and words like "tuple" consequently show up in NYT puzzles.

    ReplyDelete

Related Posts Plugin for WordPress, Blogger...