What is One-Liner, Code Golf, Obfuscation Contest
What is One-Liner, Code Golf, Code Obfuscation
- One-liner is a programing challenge where the code solution of a given problem is entirely in one single line.
- Code Golf is a programing contest where the goal is to write the shortest solution of a given problem, in terms of character count.
- Code Obfuscation is similar.
One-liner evolved into code golf and code obfuscation.
One-Liner, Defined as Count of Character
Traditionally, one-liner is defied as being one single line, and typically within 80 characters.
This is suitable for perl.
An extended definition is, a contest of the shortest program, by character count. This constitutes code-golf.
This definition is suitable for procedural or imperative programing language, such as C.
One-liner for functional programing: one semantic unit of function call
A suitable definition for functional programing language is one single semantic unit of function call. That is, one nested call of a function, or one sequence of function chain, or mix of the above.
Why one-liner or code golf?
Why one-liner for functional programing?
Writing a program that is a single nested or sequential function call tests your mastery of functional programing.
You need to master function taking function as argument, function return function, anonymous function, inline function application, recursion, function style loop, currying, pointless-style programing, and or combinator. Most are essential elements in functional programing.
History of One-Liner, and One-Liner in Functional Programing
xtodo work in progress
One-liner began with perl.
It's highly competitive to have the shortest program by char count, in particular for procedural languages.
It's also non-trivial to make things semantically one-line, for functional programing languages. For procedural languages semantically one-line is almost impossible (except perl). For functional programing language, it depends on the language.
Here, oneliner, is defined by, literally one single connected sequence or nested function calls. (as opposed to, just compactify any lang source code by removing newline char with semicolon or such.)