This is the mail archive of the guile@cygnus.com mailing list for the Guile project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: environment-fold


Jim Blandy <jimb@red-bean.com> 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.)

/mdj

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]