Golfscript is a stack-based, somewhat functional programming language, designed to be both (relatively) easy to code in, but most importantly to win code golf contests by solving problems in the lowest amount of characters. Don't believe me? This program calculates the GCD of two input numbers separated by a space:

~{.@\%.}do;

~ pushes the numbers on the stack, . duplicates the stack top, @ rotates the top three stack elements counterclockwise, \ swaps the top two stack elements, % calculates the modulo and pushes it on the stack, and a {...}do loop pops a value, jumping to the start if it is true. (It's a stack-based interpretation of the Euclidean algorithm: (a,b) -> (b,a%b) until b is zero.)

Confusing at first, then addicting when you get it, then frustrating when you can't cut off those 5 extra bytes to beat the currently winning submission.

Log in or register to write something here or to contact authors.