

Ask HN: Historically Important Code Snippets? - ybot

Hey HN,<p>I've been teaching an artist friend of mine how to code. She's been loving it and recently has started to incorporate programming concepts into her other art. She's planning on doing a series of paintings that incorporate code snippets.<p>Here's an early example: http://i.imgur.com/itPcm.jpg<p>I showed her Quake III's Fast InvSqrt() (http://en.wikipedia.org/wiki/Fast_inverse_square_root#Overview_of_the_code). Do you have any other other interesting, important, historically significant, or just plain quirky code snippets?
======
minopret
There's nothing as iconic as E=mc^2, but what a fun question! Here are some
ideas.

\- How about the minimal ANSI C program "int main(int argc, char __argv)
{return 0;}"?

\- You could look up the code designed by Ada Augusta, Countless Lovelace.
It's much like a spreadsheet.

\- A few code snippets are of historical interest in that they have
unfortunately caused satellites to fall out of orbit.

\- Some code snippets have been used as email signatures for political
reasons, such as short implementations of RSA or DeCSS.

\- David A. Wheeler's website has a nice rundown of modern history's important
software innovations, but only a couple of those, like RSA, can be implemented
in a few (appropriately) cryptic lines.

\- There are a number of mathematical algorithms of interest, such as the
Euclidean algorithm for greatest common divisor (GCD) and the Newton or
Newton-Raphson method.

\- Some modern fundamental algorithms such as binary search and quicksort are
compact.

\- You might like some variant of "the computus", the formula for calculating
the date of Easter. It bores me, but I enjoy the similar Zeller's congruence.

\- The movie "The Social Network" features something like the tf-idf formula
and the movie "A Beautiful Mind" features Nash equilibrium.

\- The Ackermann function is fun, being a brief and notably slow formula for
practically all arithmetic. Going the other way around you get Peano axioms
and perhaps computations with Church numerals.

\- A grammar for the lambda calculus can be three simple lines.

\- Our gracious host in "The Roots of Lisp" states Lisp "eval" somewhat
briefly, based on McCarthy's original, which Alan Kay called "Maxwell's
equations of software".

\- The truth table for NAND is a nice little graphic and the NAND function
happens to be sufficient to implement all Boolean functions.

Now we could start to get into other diagrams from computer science and
software engineering, but that's a vast area and you didn't actually ask for
it.

------
jolan
<http://en.wikipedia.org/wiki/Duffs_device>

