Skip to content
Remarks on Style

Parentheses

Avoid unnecessary parentheses. The grammar of q is simple and there is no precedence order for the primitives. For example, the expression to multiply a by the sum of b and c:

a*b+c

should not be written

a*(b+c)

Redundant parentheses are visual red herrings.

Although extra parentheses are useful as training wheels, most q programmers eventually internalize the preferred method of reading q, which is left to right. To encounter a parenthesized expression is to assume that the parentheses are necessary.