Code: Select all
>>> lst = [3, 2, 1]
>>> s = iter(lst)
>>> s
<listiterator object at 0xb741e0cc>
>>> s.next()
3
>>> s.next()
2
>>> s.next()
1
>>> s.next()
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
StopIteration
Code: Select all
>>> lst = [3, 2, 1]
>>> s = iter(lst)
>>> s
<listiterator object at 0xb741e0cc>
>>> s.next()
3
>>> s.next()
2
>>> s.next()
1
>>> s.next()
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
StopIteration
Code: Select all
(context 'next)
(setq seenSymbols '())
(define-macro (next:next aList)
(unless (ref (string aList) next:seenSymbols)
(push (list (string aList) (copy (eval aList))) next:seenSymbols))
(pop (next:seenSymbols (first (ref (string aList) next:seenSymbols)) 1))
)