Skip to content

Terminology

In 2018 and 2019 the vocabulary used to describe the q language changed. Why?

The q language inherited from its ancestor languages (APL, J, A+, k) syntactic terms that made the language seem more difficult to learn than it really is.

So we changed them.

Inheritance

Iverson wrote his seminal book A Programming Language at Harvard with Fred Brooks as a textbook for the world’s first computer-science courses. He adopted Heaviside’s term for higher-order functions: operator. It did not catch on. The term retains this usage in the APL language, but in other languages denotes simple functions such as addition and subtraction. Similarly Iverson’s monadic and dyadic are better known as unary and binary.

In 1990 Iverson and Hui published a reboot of APL, the J programming language. Always alert to the power of metaphor, they referred to the syntactic elements of J as nouns, verbs, and adverbs, with the latter two denoting respectively functions and higher-order functions. Canadian schools used to teach more formal grammar than other English-speaking countries. Perhaps this made the metaphor seem more useful than it now is.

In 2017 an informal poll in London of senior q programmers found none able to give a correct definition of adverb in either English or q. Iverson & Hui’s metaphor no longer had explanatory value.

Worse, discussions with the language implementors repeatedly foundered on conflicting understandings of terms such as verb and ambivalent.

The terms we had inherited for describing q were obstacles in the path of people learning the language. We set out to remove the obstacles.

Revision

In revising, our first principle was to use familiar programming-language terms for familiar concepts. So + and & would be operators. Primitive functions with reserved words as names became keywords. We had no role for verb. Functions defined in the functional notation would be lambdas, anonymous or not. Operators, keywords, and lambdas would all be functions. Monadic, dyadic, and triadic yielded to unary, binary, and ternary.

Removing verb drained the noun-verb-adverb metaphor of whatever explanatory power it once had. Many candidates were considered as replacements. Iterator was finally adopted at a conference of senior technical staff in January 2019.

The isomorphism between functions, lists and dictionaries is a foundational insight of q. It underlies the syntax of Apply and Index. Defining

  • the application of functions
  • the indexing of arrays
  • the syntax and semantics of iterators

requires a portmanteau term for the valence of a function or the dimensions of an array. We follow the usage of J in denoting this as rank, despite the rank keyword having a quite different meaning.

Changes

The following tabulates the changes in terminology. The new terms are used consistently on this site.

Training materials must adopt them to ensure consistency with reference articles.

old new
adverb iterator
ambivalent variadic
char vector string
dimensions rank
dyadic binary
monadic unary
niladic nullary
triadic ternary
valence rank
verb operator
verb keyword

Recommendations

Consistency helps the reader. Variations in terminology that do not mark a distinction add to the reader’s cognitive load.

This site uses the following terms consistently. If you are writing about q, we recommend you adopt them too.

deprecated preferred
array list
element item, list item
indices indexes
input, parameter argument
matrices matrixes
output result

Glossary