Some notes on twelve.days

The variables

Since each day of the twelve brings its own gift, one natural way to record the information necessary for gifts to produce the gift lists is to set up a series of variables with the days as their names and the corresponding gifts as their values. For example:

make "third [three french hens]
make "ninth [nine drummers drumming]
The count up of the days in twelve.days and the count down of the days in gifts are controlled by the changing values of :day and :today. For :day and :today to be treated as numeric variables by Logo, however, their values must be cardinal numbers (such as 3, 9 . .) rather than ordinal numbers (such as those used in the verses to name the days - third, ninth . .). One way to relate the name of a day to its corresponding cardinal number (so that the input variable in twelve.days can be used to retrieve the name of the day) is to create a further set of variables which use cardinal numbers as their names and ordinal numbers as their values. For example:

make "3 "third
make "9 "ninth
In twelve.days , the expression thing :day (i.e. thing thing "day), can now be used to access the day's name. If :day has the value 3, then thing :day evaluates to "third.

But notice also that the two sets of variables are now interestingly interconnected - while the variable called "3 has the value "third, "third itself is the name of a variable with the value [three french hens]. Because of this interconnection it possible to use the cardinal value of the input variable in gifts to retrieve the gift for the day, through the expression thing thing :today (i.e. thing thing thing "today).

The use of vprint

Because of the way in which gifts builds up its eventual final output (as a list of lists), the recursive procedure vprint, which we introduced earlier, turns out to be the ideal tool to display the various gifts as a series of separate lines of verse.

For more detail on outputs of the type created by gifts, look here.

Ron Brasington
Department of Linguistic Science
The University of Reading