Documention for: twelvedays.r
Created by: btiffin
on: 12-May-2007
Format: html
Downloaded on: 17-Oct-2024

Usage document for %twelvedays.r

1. Introduction to %twelvedays.r
2. twelvedays At a Glance
3. Using %twelvedays.r
3.1. Running %twelvedays.r
4. What you can learn
5. What can break
6. Credits

1. Introduction to %twelvedays.r

twelvedays.r prints out all the lyrics for the popular Christmas song, The Twelve Days of Christmas.

2. twelvedays At a Glance

Not setup is required, just doit.

3. Using %twelvedays.r

3.1. Running %twelvedays.r

Evaluate the script directly out of the rebol.org library with

 >> do http://www.rebol.org/cgi-bin/cgiwrap/rebol/download-a-script.r?script-name=twelvedays.r
 
or locally with
 >> do %twelvedays.r
 

4. What you can learn

This script is a fair example of information hiding. The Twelve_Days object! encapsulates a function, Sing that also encapsulates another function, Gift. Both of these inner functions make proper use of local variables.

The script only exposes the Twelve_Days object into the global name space. Everything else is hidden within this naming context.

Plus you get to learn the proper lyrics for the Twelve Days of Christmas rhyme.

5. What can break

Nothing to break here.

6. Credits

%twelvedays.r Author: Unknown
Twelve Days of Christmas Rhyme originally in Mirth without Mischief, circa 1780