Version 3 of Iterator Protocol

Updated 2012-10-22 08:13:39 by pooryorick

With the advent of coroutines, Tcl now has an iterator protocol. The protocol is simple: An iterator is a command which one calls repeatedly until the command no longer exists. The last value returned by the command before it ceases to exist should not be considered one of the iterated values, as the iterator command has no way of knowing whether it is finished or not until the last time it is called, and must therefore return one time after there are no more valid values to return. for ... in ... is a drop-in replacement for the standard for command which supports an expanding syntax for looping over iterators.