Green Eggs and Ham FEB 20 2009
After writing The Cat in the Hat in 1955 using only 223 words, Dr. Seuss bet his publisher that he could write a book using only 50 words. Seuss collected on the wager in 1960 with the publication of Green Eggs and Ham. Here are the 50 distinct words used in the book:
a am and anywhere are be boat box car could dark do eat eggs fox goat good green ham here house I if in let like may me mouse not on or rain Sam say see so thank that the them there they train tree try will with would you
From a programming perspective, one of the fun things about Green Eggs and Ham is because the text contains so little information repeated in a cumulative tale, the story could be more efficiently represented as an algorithm. A simple loop would take the place of the following excerpt:
I do not like them in a box.
I do not like them with a fox.
I do not like them in a house.
I do not like them with a mouse.
I do not like them here or there.
I do not like them anywhere.
I do not like green eggs and ham.
I do not like them, Sam I am.
But I don't know...
foreach (\$items as \$value) doesn't quite have the same sense of poetry as the original Seuss.