[plt-scheme] (newbie question) About Loop
Neil Van Dyke
neil at neilvandyke.org
Fri Jun 12 15:56:40 EDT 2009
> straightforward, standard and with no intermediary list building:
>
> (do ((i 0 (+ 1 i)))
>
"do" is standard for now, but I dream that we will someday right that
wrong. "do" is a cryptic bit of syntactic sugar that gets in the way of
refining functional algorithms.
Instead of "do", I suggest using named-"let" unless "map", "for-each",
folds, etc. fit the problem naturally.
I think that the benefit of avoiding "do" will be more obvious when
writing idiomatic Scheme code for problems that actually occur in
nature, not contrived exercises (like, e.g., "do this 7 times for no
particular reason and with no data being processed").
--
http://www.neilvandyke.org/
More information about the plt-scheme
mailing list