Idiom

The term idioms is used in the community to mean either of two distinct (but overlapping) groups of expressions:


 * Idiomatic expression, that is, a construct that is often employed by experienced APLers and that these can therefore spot and understand without thinking about their constituent parts.
 * Optimised phrase, that is, a string of tokens that the interpreter recognises as a whole, directly computing a result rather than evaluating each in turn.

These constructs are not necessarily optimal, and on occasion, they are later found to have flaws.

Ironically, the most common meaning of idiom, "a phrase or expression that typically presents a figurative, non-literal meaning attached to the phrase", is never used in the context of APL, effectively rendering the word idiom an actual idiom in the most common sense of the word.

Idiomatic expressions
Some constructs tend to be needed often, and either lend themselves well to one particular phrasing, or is generally taught with a single spelling such that this spelling propagates throughout the community. Examples include:
 * (using Dyalog APL or similar) or  (using APL2 or similar) is often employed to split a character vector   on a separator character.
 * (or similar), which for several decades was used to find the unique elements of  in dialects without the   primitive, including in many well-regarded works. However, at Dyalog '17, Roger Hui presented his findings that this historical expression for Unique (which was used internally for the primitive) was was wrong on floating point numbers, due to some false assumptions about Index of, and suggested a more involved model.

Optimised phrases
A technique for increasing the performance of an interpreter is executing select idiomatic expressions as single units, instead of going through their constituent parts. This allows using alternate algorithms for achieving the result, which might be faster and/or use less memory. Examples include:
 * (in Dyalog APL or similar) or  (in APL2 or similar) to "transpose" a vector of vectors, also known as zipping. Applying Mix (  or  ) would temporarily create a matrix containing all the elements, thus requiring a large contiguous memory allocation, whereas the result goes back to only requiring multiple smaller allocations. Computing the final result directly can be the difference between being able to perform the operation and exceeding memory limits.
 * to sort: It is often faster to sort than grade, but most implementations do not include sorting primitives. Therefore, recognising this and similar constructs, allows the interpreter to speed up sorting. The idiom has, however, the downside of only working with vectors, while higher-rank arrays would need trailing semicolons inside the square bracket. Dyalog APL therefore added  as an alternative, rank-agnostic idiom.