kottke.org

...is a weblog about the liberal arts 2.0 edited by Jason Kottke since March 1998 (archives). You can read about me and kottke.org here. If you've got questions, concerns, or interesting links, send them along.

Green Eggs and Ham by Dr. Seuss

Green Eggs and Ham

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.

By Jason Kottke    Feb 20, 2009 at 11:56 am    books   Dr. Seuss   greeneggsandham   language   programming

kottke.org, quickly...

The best way to get a sense of what kottke.org is all about is to head to the front page or check out some random entries from the archives. Follow kottke.org via RSS or Twitter.

Want to share your something special with kottke.org's readers? Sponsor the RSS feed for a week!

Looking for work?

See more on the Job Board.