The Twelve Days of Christmas

This collection of procedures and variables can be used to display the verses of The Tweve Days of Christmas. To test the system, either copy and paste the procedures and names into your editor so that they can be defined, or click here for for an unannotated Logo file which you can save as text ready to load directly into your workspace.

The toplevel procedure is called twelve.days. It expects as its input (:day) a number between 1 and 12 which is used to determine the verse at which the display begins. To display the complete set of verses, type twelve.days 1

You may also want to read some explanatory notes on the implementation.

to twelve.days :day
print [] 
if :day > 12 [stop] 
( print [the] thing :day [day of christmas] ) 
pr [my true love sent to me] 
vprint gifts :day 
twelve.days :day + 1 
end

to gifts :today
if :today = 0 [op []] 
op fput thing thing :today gifts :today - 1 
end

to vprint :list
if empty? :list [stop] 
print first :list 
vprint bf :list 
end

make "first [a partridge in a pear tree]
make "second [two turtle doves and]
make "third [three french hens]
make "fourth [four colly birds]
make "fifth [five gold rings]
make "sixth [six geese a laying]
make "seventh [seven swans a swimming]
make "eighth [eight maids a milking]
make "ninth [nine drummers drumming]
make "tenth [ten pipers piping]
make "eleventh [eleven ladies dancing]
make "twelfth [twelve lords a leaping]

make "1 "first
make "2 "second
make "3 "third
make "4 "fourth
make "5 "fifth
make "6 "sixth
make "7 "seventh
make "8 "eighth
make "9 "ninth
make "10 "tenth
make "11 "eleventh
make "12 "twelfth


Ron Brasington
Department of Linguistic Science
The University of Reading
Reading
UK

E-mail: ron.brasington@rdg.ac.uk