[plt-scheme] Iterating through days of the week

From: Danny Yoo (dyoo at cs.wpi.edu)
Date: Wed May 2 03:30:09 EDT 2007

On Wed, 2 May 2007, SpinyNorman wrote:

> I see that there is a standard way of getting date info such that Sunday 
> through Saturday are days 0 through 6.  I want to generate text for a 
> week's worth of days.

Hi SpinyNorman,

Have you looked at "How to Design Programs"?  This seems like a basic 
enough question that you might find it helpful.


> While I was looking up "begin," I did see some pretty good doc on
> "do," but it looks as if it allows for some very sophisticated
> variations, whereas I need something really basic -- just count up
> from zero, use the index for a calculation, and when you get to seven
> (or after passing six), stop.

This sounds like a direct application of the material in Section 11 of the 
HTDP textbook:


There are a few more ways of doing this kind of iteration in the language, 
but my guess is that you're looking for a textbook-style solution first?

Good luck!

Posted on the users mailing list.