Conway's Game Of Life in one line of APL
youtube.com
youtube.com
"There are three things a man must do
before his life is done;
Write two lines in APL,
And make the buggers run."
-- Stan Kelly-Bootle, 'The Devil's DP Dictionary'
And: "APL is a mistake, carried through to perfection.
It is the language of the future, for the programming
techniques of the past: it creates a new generation
of coding bums."
-- Edsger DijkstraI know he was probably following a script to spare us the trial & error. I also know the hieroglyphs could be replaced with ascii-keywords to make it look more down to earth. But still; if I was to come up with a game of life in any language then the process wouldn't look anywhere near this elegant...
Not really, that is APL. The keywords in the APL language are mathematical symbols (Greek letters plus a lot more). http://aplwiki.com/AplCharacters#What_exactly_is_.22APL385_U... The result is readable (I assume) to a mathematician, but is hard for mere mortals to read and hard to type without a special keyboard.
EDIT: Picture of the keyboard layout: http://www.users.on.net/~farnik/upload/APL2union.gif
You can also get APL stickers that fit onto any keyboard (I put them onto an hp 1000 laptop even) from here: http://hooleon.com/miva/merchant.mvc?Screen=PROD&Product... for about 15 dollars. They actually work really well - I would advise using a pair of tweezers to get them positioned exactly how you want because one they are on they are pretty permanent!
The link mentioned in the video, which gives a fuller explanation, is here: http://www.dyalog.com/dfnsdws/n_life.htm
I love all those special characters, too. So much easier and quicker to read (chunk) than method names and so on.
And I expect the audio track to be sampled on a forthcoming relaxation tape.
For me it was similar to obfuscated C code, when one line of code packed with funny symbolic names produces a program that shows a bouncing ball or something unexpected like that.
edit: also my first time seeing APL, very neat stuff.
That's why I like languages with REPL-like functionality (Lisp, Python, Haskell, etc) so much. It makes for much faster debugging/development loop.
Whenever I code Java/C, I always end up using a tiny 'Testing' file (on the side of my real project) with lots of print statements that serves as a poor man's REPL. But it's still much slower.
Fair enough, and good to know. It was a very cool demo, I just don't care for the "in one line" or "in fifteen minutes" nonsense.
With different programming languages and different skill levels, you have a different amounts of "wasted time" to do the (constant) useful work.
The person doing the YouTube video wasted almost no time (a couple of typos). If I were to do it, I would have a lot of wasted effort since I never was very good at APL and time has not improved that.
work = effort * distance
In physics, if you don't move something, you have done no work (even though you are sweating and out of breath). In programming, if all you do is write boilerplate stuff, you have not done any work because you have not advanced toward your goal.
(all typos are mine, not the author's)
life ← { ⊃ 1 ω ∨ . ∧ 3 4 = +/ +⌿ 1 0 ‾1 ∘.θ 1 - ‾1 Φ″ ⊂ ω }
Thanks for a great solution for insomnia!!