I can't beat the Lisp version, but it's still fun.
The Delphi version:
procedure TheTwelfDaysOfChristmas(const AVerse: TStrings);
const
cPresentList : array[1..12] of string = (
'a partridge in a pear tree',
'two turtle doves, and ',
'three french hens, ',
'four calling birds, ',
'five gold rings, ',
'six geese a-laying, ',
'seven swans a-swimming, ',
'eigth maids a-milking, ',
'nine ladies dancing, ',
'ten lords a-leaping, ',
'eleven pipers piping, ',
'twelve drummers drumming, '
);
cTime : array[1..12] of string = (
'first',
'second',
'third',
'fourth',
'fifth',
'sixth',
'seventh',
'eighth',
'nineth',
'tenth',
'eleventh',
'twelfth'
);
var
present : string;
i : Integer;
begin
present := '';
for i := 1 to 12 do begin
present := cPresentList[i] + present;
AVerse.Add(Format('On the %s day of Christmas my true love gave me %s.',
[cTime[i], present]));
end;
end;
By the way, for all of you, Happy holidays and great programming in 2009.