emacs-devel
[Top][All Lists]
Advanced

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

Re: Generator Examples


From: T.V Raman
Subject: Re: Generator Examples
Date: Sat, 24 Sep 2016 19:26:35 -0700

The bit you wrote in response to my "dont understand why nested
iter-yield" might do well in the manual. Also, it might do what it
claims, but why it does it is opaque -- and examples that do something
useful are usually easier to learn from.

Michael Heerdegen writes:
 > 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.

-- 

-- 



reply via email to

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