[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Generators (iterators) for Gnu Emacs

From: Michael Heerdegen
Subject: Re: Generators (iterators) for Gnu Emacs
Date: Sat, 06 Dec 2014 01:13:18 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.0.50 (gnu/linux)

Daniel Colascione <address@hidden> writes:

> Assuming both packages are suitable for inclusion into core, we can
> definitely make them work together.

Thinking a bit about it, I guess my (only) constructor:

(defmacro gen-make (&rest body)
  "Return a generator that evaluates BODY to generate elements.
  (let ((this-element (make-symbol "this-element")))
    `(let (,this-element)
       (lambda ()
         (if (eq ,this-element 'gen-done)
           (setq ,this-element (progn ,@body)))))))

is just a special case of Daniel's `lambda-generator':

(defmacro gen-make (expr)
  `(lambda-generator ()
     (while t (yield ,expr))))

modulo (at least currently) the different kind of termination (right?).

So, all of my stuff can be expressed in terms of Daniels generators.
Which means that it would be a suitable extension to Daniels package,
defining some special generators, the transducers, and the cache, for
his more general kind of generators.  It could then be named
"generator-x" or so.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]