Tacit programming

Tacit programming, also called point-free style, refers to usage of tacit functions that are defined in terms of implicit arguments. This is in contrast to the explicit use of arguments in dfns and tradfns (which have named arguments). Some APL dialects allow to combine functions into trains following a small set of rules. This allows creating complex derived functions without specifying any arguments explicitly.

Dialects which implement trains include Dyalog APL, dzaima/APL, ngn/apl and NARS2000.

Primitives
All primitive functions are tacit. Some APLs allow primitive functions to be named.

Derived functions
Functions derived from a monadic operator and an operand, or from a dyadic operator and two operands are tacit functions:

Derived operators
A dyadic operator with its right operand forms a tacit monadic operator:

Trains
A train is a series of functions in isolation. An isolated function is either surrounded by parentheses or named.

These rules are used for 3-trains: The left tine of a fork can be an array:

In APL (but not J), these rules are used for 2-trains:

Debugging
In Dyalog APL, analysis of trains is assisted by a user command. This is achieved by executing the command  and then entering a train without any parameters. A structure of the train will be displayed.

For example, the "accursed train" from the section below can be analysed like this:

Alternatively, a train can be represented in form of a tree: Or fully parenthesised:

Conversion to dfns
It can help understanding to convert a tacit function to a dfn. For many tacit functions, it is not immediately clear if the intention of the function is to be used monadically or dyadically, or even both. Such knowledge can be conveyed by comments, but sometimes it is possible to spot patterns that are exclusively monadic or dyadic: A function with a bound argument (for example ) can indicate a monadic function, and in some contexts, , which can only be used dyadically, would indicate a monadic function. The website tacit.help provides automated translation of most tacit functions, into both monadic and dyadic, fully parenthesised dfns.

Examples
One of the major benefits of tacit programming is the ability to convey a short, well-defined idea as an isolated expression. This aids both human readability (semantic density) and the computer's ability to interpret code, potentially executing special code for particular idioms.

Fractions
We can convert decimal numbers to fractions. For example, we can convert $$2.625$$ to the improper fraction $$\tfrac{21}{8}$$ with Alternatively, we can convert it to the mixed fraction $$2\tfrac{5}{8}$$ with a mixed fraction:

Component of a vector in the direction of another vector
Sometimes a train can make an expression nicely resemble its equivalent definition in traditional mathematical notation. As an example, here is a program to compute the component of a vector $$\textbf{a}$$ in the direction of another vector $$\textbf{b}$$:
 * $$\textbf{a}_\textbf{b} = (\textbf{a}\cdot\hat{\textbf{b}})\hat{\textbf{b}}$$

For a more parallel comparison of the notations, see the comparison with traditional mathematics.

The Number of the Beast
The following expression for computing the number of the Beast (and of I.P. Sharp's APL-based email system, 666 BOX) nicely illustrates how to read a train. First,  is supplied with only one argument   and is thus interpreted monadically.

Second,  is a 4-train: reading right-to-left, the last 3 components are interpreted as the fork   and the 4-train is interpreted as the atop. Similarly,  is also a 4-train and interpreted as the atop.

Thus the accursed train is interpreted as. Having read the train, we now evaluate it monadically. Note that  is a train computing primes up to the given input.

A more satisfying variation of the accursed train is the following.

In text form

 * Learning APL: Trainspotting
 * Dyalog documentation: version 14.0 release notes
 * Dfns workspace: Translation of [dfns into tacit form]
 * APL Cultivation: Transcribing to and reading trains
 * gitonthescene: Forks: Spoon fed
 * gitonthescene: Training day

Videos

 * APLtrainer: How to read trains in Dyalog APL code
 * APLtrainer: Function trains in APL
 * Dyalog webinar: Train Spotting in Dyalog APL
 * Dyalog '13: Train Spotting in Version 14.0