One-liner


 * This article is about one-liners in APL. For other languages, see Wikipedia.

A one-liner is an APL program consisting of a single line of code. Creating such programs to perform various tasks, which might be considered a less precisely-measured form of code golf, was a popular challenge in early APL. The one-line constraint was significantly more limiting in this era, as it prevented creating defined functions or using Branch for control flow, and other possibilities like Each did not exist until the development of nested APLs. Once introduced, Execute became one possibility for performing repeated evaluation. Like excessive code golfing, writing in an unusual style solely to fit code into a single line is sometimes criticized as harmful to readability.

"In the case of a well-known conversational programming language I have been told from various sides that as soon as a programming community is equipped with a terminal for it, a specific phenomenon occurs that even has a well-established name: it is called “the one-liners”. It takes one of two different forms: one programmer places a one-line program on the desk of another and either he proudly tells what it does and adds the question “Can you code this in less symbols?” —as if this were of any conceptual relevance!— or he just asks “Guess what it does!”"

- —E. W. Dijkstra