Constant

is a monadic operator which takes an array as its operand and becomes a function which returns the operand array regardless of its arguments. It was first introduced in Extended Dyalog APL, sharing its glyph with Commute, and was adopted in Dyalog APL 18.0 as an alternative to the constant dfn such as.

Examples
The need for Constant arises in various contexts, such as at the rightmost branch in a train and mapping over an array to create a constant-filled one. The major advantage of Constant  over a constant dfn   is that the array   is evaluated only once at definition time, rather than every time the function is called.

Trains
If the rightmost branch of a train is an array, it is not recognised as a train at all. This problem can be worked around in many ways, but none is visually appealing. The Constant operator gives a natural solution to this problem.

Other uses
Sometimes, one needs a constant function that returns one of the arguments of the outer dfn. Simply writing  does not work;   does.

Using Constant is also cleaner when doing a constant fill.

Webinars

 * Dyalog Webinar

Lessons

 * APL Cultivation

Documentation

 * Dyalog