Binary Clock in 88 Characters
/I find computer-science fictional interfaces e.g. alien clocks, rather exquisite. The timepiece above is a favorite of mine. The countdown graphic is displayed on the villain's tri-lithium missile launching platform in the movie Star Trek Generations. A number of fun blogs have surfaced recently that catalogue and explore various sci-ware interfaces from movies. Here's a few good ones: fakeui, access, movie code. Anyways, I had a free hour so I went and coded up an iPhone app for a clock that tells time in a user supplied base.
If you've never heard of a binary clock it's really simple. The example above on the right is counting seconds from 12:01 to 12:02. Here the columns correspond to the six decimal numbers h, h, m, m, s, s in base two (from left to right). Now, sadly the c-source would never fit into one small blog post and in the end, hundreds of lines of code were needed - lo the inelegance of the Objective-C language. But functional languages allow for breathtaking brevity, instead of over 100 lines, we use under 100 characters! Here's that 1-liner:
This generates the binary clock above on the left (rows are h, m, s in binary from top to bottom). Of course, this isn't deployable code, yet... In future versions of Mathematica, as it is strongly typed, the kernel may be able to use clang to transform the expression into proper objective-c for iOS deployment (but that's just my pipe-dream).