Dear Marc,

A |table-for-each| whose traversal continuation is wrapped in a closure would be much needed!

Actually, this could be delivered by a |table-for-each| that is wrapped completely into a closure i.e.

(table-enumerator table) => a procedure either returning a pair (key . value), or #f = reached table's end.

Preferably this should implemented as part of Gambit itself, as the hashtables functionality is Gambit-internal.


The reason for the need is that sometimes you need to be able to return at dynamic points within a table traversal in the same fashion as you can in an ordinary Scheme loop.

It's easy to traverse a list or a vector in this fashion using |car|/|cdr| and |vector-ref| , however for tables right now there's no way to do the same but all that is locked into |for-each|'s semanstics which is incredibly limited as long as you don't work around it using |call/cc| , which is really unnecessary - so, |table-enumerator| implementation time? :D

Reflections?

Thanks,
Mikael