One-liner Wars N. A Game Popular Among Hackers Who Code In The Language APL (see Write-only Language And Line Noi And/or Useful Routine In One Line Of Operators Chosen From APL's Exceedingly Hairy Primitive Set.

HomeFortune CookiesJargon File

one-liner wars n.

A game popular among hackers who code in
the language APL (see write-only language and line noi
and/or useful routine in one line of operators chosen from APL's
exceedingly hairy primitive set. A similar amusement was
practiced among TECO hackers and is now popular among
Perl aficionados.

Ken Iverson, the inventor of APL, has been credited with a
one-liner that, given a number N, produces a list of the
prime numbers from 1 to N inclusive. It looks like this:

(2 = 0 +.= T o.| T) / T <- iN

where `o' is the APL null character, the assignment arrow is a
single character, and `i' represents the APL iota.

Here's a Perl program that prints primes:

perl -le '$_ = 1; (1 x $_) !~ /^(11+)\1+$/ && print while $_++'