APL.

T←'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,' 'Eight maids a-milking,' 'Nine ladies dancing,' 'Ten lords a-leaping,' 'Eleven pipers piping,' 'Twelve drummers drumming,'
C←'first' 'second' 'third' 'fourth' 'fifth' 'sixth' 'seventh' 'eighth' 'nineth' 'tenth' 'eleventh' 'twelfth'
∇ line X
    ⎕←'On the',C[X],'day of Christmas'
    ⎕←'My true love sent to me'
    {⎕←⍵}¨⌽(X≥⍳12)/T
    ⎕←''
∇
line¨⍳12

comments