[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Generator Examples
From: |
Michael Heerdegen |
Subject: |
Re: Generator Examples |
Date: |
Sun, 25 Sep 2016 03:03:32 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/25.1.50 (gnu/linux) |
raman <address@hidden> writes:
> The cl-psetq is the right idiom here in that sense -- if you use plain
> setq, you'd have to use a temporary variable?
Sure, but I want to avoid to confront people with functions they
potentially don't know in these examples, so that they can concentrate
on the gist. A minor issue, sure.
> Thanks for the coroutine example, again that would do well in the
> manual -- there is a reference to coroutines either in the manual or
> in code comments in generators.el that is presently "intriguing".
AFAIK the original author wanted to add some code for working with
coroutines.
> Finally, I still dont understand the nested call to iter-yield in the
> manual and if it is correct, it would be good to have it better
> explained there.
I think it is correct (behaves exactly as described, and the behavior is
what I expect). What in particular don't you understand?
I think the thing that this part wants to demonstrate is that
`iter-yield' behaves normally wrt when it is evaluated (function
arguments before function calls etc.; so the inner `iter-yield' is
called first, and the outer not before the iterator has been restarted).
And the outer `iter-yield' yields a value that is computed from the
"return value" of the inner, which is the second argument of the
according `iter-next' call.
Michael.