This is the mail archive of the
mailing list for the Guile project.
- To: Jim Blandy <firstname.lastname@example.org>
- Subject: Re: environment-fold
- From: Mikael Djurfeldt <email@example.com>
- Date: 10 May 1999 12:01:52 +0200
- Cc: firstname.lastname@example.org
- Cc: email@example.com
- References: <199905091759.MAA07881@savonarola.red-bean.com>
Jim Blandy <firstname.lastname@example.org> writes:
> Someone mailed me a while back, saying that they felt environment-fold
> was a clumsy way to iterate over an environment's bindings. I'm not
> sure it's the most graceful thing in the world either, and I'm open to
> alternatives. Could that person please post some?
I find `environment-fold' a beautiful and powerful construction---so
powerful, in fact, that it's easy to write most other iteration
constructs in terms of it (but not vice versa).
Whether or like it or not probably has a lot to do with whether you're
accustomed to program functionally or not.
I'd say that `environment-fold' makes it easier to be able to stick to
the functional style. Maybe we could have `environment-fold' as
primitive and define `environment-map' and `environment-for-each' in
terms of it?
(BTW, I think `environment-fold' should take the procedure argument as
first argument and the environmetn as the last one, just as all other
iteration constructs, and similar to rfold and lfold.)
(I'd very much like to see rfold and lfold in Guile as well.)