Juan F. Meleiro

Stylistic devices in math and programming

We use stylistic devices all the time in day-to-day speech and writing. As an example, whenever we refer to something by one of its parts (“I know that voice” vs. “I know the *owner* of that voice”), we engage in *synedoche*. Depending on your inclinations, you might use metaphors now and then.

But this is not restricted to spoken and written language, in a sense, because stylistic devices seem to be convergent solutions to common expressive problems. In math and programming, where one often needs to express complex ideas in written (and spoken) language, we might reach for some stylistic devices as well. Specifically in programming, these might be just choices about how to write something (e.g., choosing meaningful variable names might be a charactonym), but might be something a language supports (e.g., implicit arguments as a form of synedoche).

This page aims to collect instances of math and programming stylistic devices found in the wild, while maybe listing potentially novel uses.

Endophora

When an expression derives its reference from something within surrounding text, called its “antecedent”.

There are distinct kinds of Endophora.

Anaphora

An endophora where the antecedent actually occurs before the expression itself.

*Example*: In Emacs Lisp, the library `dash` provides anaphoric versions for its functions.

For example,

(-map (lambda (n) (* n n)) '(1 2 3 4)) ; Normal version.
(--map (* it it) '(1 2 3 4))           ; Anaphoric version.

Deixis

A species of exophora, where the antecedent of the expression comes from outside the text. Deixis seems to be used when talking specifically about words whose reference depend on time, place, and speaker. Obvious examples are personal pronouns (“I”, “you”, “they”) and demonstratives (“there”, “here”).

In programming, you might find this when working in object-oriented paradigms in their use of keywords like `this` `self`.

class Foo {
	int x;

	public Foo(int x) {
		this.x = x;
	}

	public greet() {
		System.out.println("Hello, " + this.x + "!");
	}
}

Metonymy

Refering to something by a part closely related concept.

In math, it is overwhelmingly common to refer to a structure by one of its components. Usually, its base set of points.

Let V be a vector space. Consider a vector x ∈ V. […]

It's ambiguous what's the metonymy at play here (curiously, ambiguity is another stylistic device). On the one hand, we might say `V` refers to the vector space, and the second instance of it is a metonymy of type whole-for-the-part. Alternatively, we might say that `V` actually refers to the set of vectors, and the *first* instance is a metonymy of the kind part-for-the-whole.