I was just reading through S07, and it occurred to me that if one
wanted to, one could handle stacks and queues as iterators, rather
than by push/pop/shift/unshift of a list.  All you'd have to do would
be to create a stack or queue class with a private list attribute and
methods for reading from and writing to it.  The first two parts are
easy: "has @!list;" handles the first, and "method prefix:<=> { .pop
}" handles the second (well, mostly).

How would I define the method for writing to an iterator?

Jonathan "Dataweaver" Lang

Reply via email to