Fri Feb 6 15:31:43 CET 2009

Data structure traversal in C

In a block-scoped language without proper lexical closures,
comprehensions (iteration macros) are easier to use than iteratatee
objects (higher order functions) -- the operation passed to an

The reason is that the body of the comprehension has access to the
lexical environment outside of that body.

In this scenario, factor out the data structure's FIRST and NEXT
operations into procedures, and construct a trivial FOR macro using
those based on C's for( _ ; _ ; _) construct.

They are more limited: the comprehension loop block cannot be reused,
while (stateless) iteration objects can be.

EDIT: it is all about the difference between ``let'' and ``lambda''.
The latter ``forks'' the stack while the former does not.