Search code examples
data-structuresterminologynaming

What are some accepted terms for an object with exactly three properties?


Many of you are likely familiar with the term (and well defined struct in many languages) that is a key-value pair, or kvp for short.

I'm not asking for opinions or a scholarly debate here - the term key-value pair is derived from strongly typed languages where this is an actual type (i.e. https://learn.microsoft.com/en-us/dotnet/api/system.collections.generic.keyvaluepair-2?view=net-7.0).

I want to know if there are commonplace or accepted terms for a data struct that has three and only three properties - much like the KVP struct provides a contract that it will have a key and a value - with links to good sources (i.e. early C++ documentation, API docs, some IEEE standard somewhere) that shows this data struct and it's name in actual use.

Are there examples of these sorts of data structs in any strongly typed languages of today? Is it a Triad? A Thruple? A Troupe?

I've been searching the big bad web and come up short - at least in terms of finding authoritative sources.

Here's an example using TypeScript, generics, and my naive attempt at naming it:

type KeyValueTypeTriad<T> = {
  key: string;
  value: any;
  type: T;
};

Solution

  • 3-tuple or triple are commonly used in Microsoft documentation

    The Tuple<T1,T2,T3> class represents a 3-tuple, or triple, which is a tuple that has three components.

    and in IEEE, such as in this paper

    The triple N = (P, T , F) is a net

    A labeled PN is a 3-tuple GL = (N, 6, L)