Skip to content

# Terminology¶

Terminology review 2017

In 2017 the terminology used to describe Kx technology was reviewed and revised to

• use common terms for common concepts
• distinguish adverbs more clearly

The following terms are no longer used to describe q:

• monad, monadic
• dyad, dyadic
• nilad, niladic
• verb
• element of a list

Q defines twelve adverbs, denoted by six characters and character pairs.

## Q and kdb+¶

• kdb+ denotes the database and the process that manages it;
• q denotes the programming language, a domain-specific language for time series embedded in
• the k language;

## Lists¶

A list is an ordered collection of zero or more items.

Any q element (atom, list, function, adverb) may be an item of a list.

Where all its items are of the same type, a list is a vector of that type.

Mixed list, general list or simple list may be used for emphasis, but list and vector usually suffice.

### Function rank¶

A function’s rank is the number of arguments it takes.

Functions of rank 1 are unary; functions of rank 2, binary.

The terms monad, dyad, monadic, and dyadic are no longer used.

### Operators¶

All functions can be applied with prefix notation, e.g. f[x;y;z] and +[2;3].

An operator is a primitive binary function that can also be applied with infix notation.

q)2+3
5
q)3 sum 1 2 3
9


The term verb is no longer used.

### Twelve adverbs¶

An adverb is a primitive higher-order function that is applied postfix and returns a derived function, also known as a derivative.

q)total:+/
q)total[1 2 3]
6


Adverbs are distinguished from the overloaded characters and character pairs that denote them. For example, the character ' is overloaded with the adverbs case, compose, and each-both.

Between them, six characters and character pairs denote twelve adverbs.

Refer to an adverb by its name

Refer to an adverb by its name, not the (overloaded) character that denotes it.

For example, in 2 +//5 5#til 25 the adverb denoted by the first / is over and the adverb denoted by the second / is converge-repeat.

Watch out: The primitives each, over, and scan are operators that apply their function arguments. They are not adverbs, and do not return derivatives. Where an adverb applied postfix returns a derivative, an operator applied infix, but without a right argument, returns a projection.

q)(+/)1 2 3
6
q)(+)over 1 2 3
6
q)tot1:+/                / derived function
q)tot1[1 2 3]
6
q)tot2:(+)over           / projection
q)tot2 1 2 3
6
q)type each (tot1;tot2)  / derivative; projection
107 104h