[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Generators (iterators) for Gnu Emacs
From: |
Stefan Monnier |
Subject: |
Re: Generators (iterators) for Gnu Emacs |
Date: |
Fri, 05 Dec 2014 13:32:32 -0500 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/25.0.50 (gnu/linux) |
> I'd really rather signal to stop iteration. That way, it's harder to ignore
> end-of-iteration and loop forever and it remains possible to iterate over
> *any* value. condition-case is setjmp. I'm not *that* concerned by
> performance. The only other reasonable alternative is for iterators to
> yield a cons (terminal-p . value), and consing is going to be much worse
> than condition-case.
The alternative I was thinking was to return a unique value, as in:
(defvar gen-eog (make-symbol "¡end-of-generator!"))
(defun gen-eog-p (x) (eq x gen-oeg))
In terms of efficiency it should be fine (contrary to consing, indeed).
Stefan
- Generators (iterators) for Gnu Emacs, Michael Heerdegen, 2014/12/04
- Re: Generators (iterators) for Gnu Emacs, Stefan Monnier, 2014/12/04
- Re: Generators (iterators) for Gnu Emacs, Leo Liu, 2014/12/04
- Re: Generators (iterators) for Gnu Emacs, Daniel Colascione, 2014/12/04
- Re: Generators (iterators) for Gnu Emacs, Leo Liu, 2014/12/04
- Re: Generators (iterators) for Gnu Emacs, Stefan Monnier, 2014/12/04
- Re: Generators (iterators) for Gnu Emacs, Leo Liu, 2014/12/05
- Re: Generators (iterators) for Gnu Emacs, Stefan Monnier, 2014/12/05
- Re: Generators (iterators) for Gnu Emacs, Stefan Monnier, 2014/12/05
- Re: Generators (iterators) for Gnu Emacs, Daniel Colascione, 2014/12/05
- Re: Generators (iterators) for Gnu Emacs,
Stefan Monnier <=
- Re: Generators (iterators) for Gnu Emacs, Daniel Colascione, 2014/12/05
- Re: Generators (iterators) for Gnu Emacs, Daniel Colascione, 2014/12/05
- Re: Generators (iterators) for Gnu Emacs, Daniel Colascione, 2014/12/05
- Re: Generators (iterators) for Gnu Emacs, Daniel Colascione, 2014/12/05
- Re: Generators (iterators) for Gnu Emacs, Daniel Colascione, 2014/12/05
- Re: Generators (iterators) for Gnu Emacs, Daniel Colascione, 2014/12/05
- Re: Generators (iterators) for Gnu Emacs, Stephen J. Turnbull, 2014/12/06
- Re: Generators (iterators) for Gnu Emacs, Daniel Colascione, 2014/12/05
- Re: Generators (iterators) for Gnu Emacs, Daniel Colascione, 2014/12/05
- Re: Generators (iterators) for Gnu Emacs, Daniel Colascione, 2014/12/05