Posts

Showing posts from January, 2010

Constructive art on software languages

Image
If you (feel like you) need to explain a piece of art, then something sucks. But I am not saying that Haskell's Tower of Babel is true art. Perhaps it could be called constructive art (or nerdy art). Anyway, I am going to explain you how I constructed this picture. See here for the original twitpic with the tower, but it's included right below for your convenience. This is how you can reproduce the tower: Use something like Mac OS's Keynote to actually assemble the picture. Go through a nifty Haskell project and gather all Haskell 98 extensions. Use one line per pragma and format everything with a proportional font as shown. Sort the extensions (the lines) by the visual length. Results depend on the font chosen. Starting at the bottom, adjust font size per line to get a smooth slide from top to bottom. In my instance, there was some fuzzy effect due to the used proportional font and the tension between the upper case LANGUAGE and the camel-cased name of the extension in e...

Palindrom dates

@lizettegagne re-tweeted as follows earlier today (or yesterday +/-): "RT @mashable: Happy Palindrome Day everyone - 01022010! Last one was 10022001, prior to that 08311380!! Wow! They don't come around often." I hacked up the following Prolog code to get some certainty. Simple modification reveals that European ordering or YYYYMMDD ordering would lead to entirely different results. Try it out! PF ?- main. 08311380 10022001 01022010 true. % This is what a palindrom is ... palindrom(S) :- reverse(S,S). % Generate all palindrom dates; ignoring leap years. special(MDYS) :- year(_,YS), month(M,MS), day(M,_,DS), append(MS,DS,MDS), append(MDS,YS,MDYS), palindrom(MDYS). % Here is an over-approximation of dates. year(X,S) :- ranges(4,1380,2010,X,S). month(X,S) :- ranges(2,1,12,X,S). day(1,X,S) :- ranges(2,1,31,X,S). day(2,X,S) :- ranges(2,1,29,X,S). day(3,X,S) :- ranges(2,1,31,X,S). day(4,X,S) :- ranges(2,1,30,X,S). day(5,X,S) :- ranges(2,1,31,X,S). day(6,X,S) :- rang...