From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: raman Newsgroups: gmane.emacs.devel Subject: Re: Generator Examples Date: Sat, 24 Sep 2016 17:29:49 -0700 Message-ID: References: <22499.10814.549580.139539@gargle.gargle.HOWL> <87y42gltoy.fsf@web.de> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: blaine.gmane.org 1474763531 32314 195.159.176.226 (25 Sep 2016 00:32:11 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Sun, 25 Sep 2016 00:32:11 +0000 (UTC) User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1 (gnu/linux) Cc: emacs-devel@gnu.org To: Michael Heerdegen Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sun Sep 25 02:32:07 2016 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bnxMO-00071y-AK for ged-emacs-devel@m.gmane.org; Sun, 25 Sep 2016 02:32:00 +0200 Original-Received: from localhost ([::1]:36084 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bnxMM-000377-MY for ged-emacs-devel@m.gmane.org; Sat, 24 Sep 2016 20:31:58 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:57842) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bnxLM-000356-Cm for emacs-devel@gnu.org; Sat, 24 Sep 2016 20:30:57 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bnxLI-00019J-7d for emacs-devel@gnu.org; Sat, 24 Sep 2016 20:30:55 -0400 Original-Received: from mail-pf0-f182.google.com ([209.85.192.182]:33593) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bnxLI-000192-1C for emacs-devel@gnu.org; Sat, 24 Sep 2016 20:30:52 -0400 Original-Received: by mail-pf0-f182.google.com with SMTP id 21so53473538pfy.0 for ; Sat, 24 Sep 2016 17:30:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version; bh=KOBoaMvGy+c55LNVG4XIt7SZifgypQnWNDZNRG7/XqY=; b=GJQUd1bT3RzqjFGxf3sXU/za2zlEXKJo2ac/d3Pb15eWHMPqCdjQvH3SlXo6YZ2EuW ZRJFlECDTx+p7C7gMMq/Xii1P4C2fYJQEM5tbwbgRotTysjOw1PdUI0pFVFbzCHxHjHC v88YbCvk8mPptp6wKU/bIe6lTty3zOsryMr4vCRREJy1BqqS4xVEYoFmLgLM6QAHpk4w N94K0oRf8bhScK7jt52KqAgU0zJlKO6rpGac2DIWCUgA03CvFQiW5r/Hoz9dL91phSYK pDxj3FhnT2XEI6W+DvtQulLvMoF6pjGMc2wI4cUuu3vYvrLziyatrnro6aTL3A3+ki6G DeEA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:references:date:in-reply-to :message-id:user-agent:mime-version; bh=KOBoaMvGy+c55LNVG4XIt7SZifgypQnWNDZNRG7/XqY=; b=IjLRubkwBHLPcHmddcEfKdEaKYuKLtoDgmWaeMxO5LHvvyMWjR2j1SPZWfpUeVJ62w vHmVKwtEiNp70Lvt8yWwdflhH3Fg7cdxHzGPIGyRlL/IuvsQ5+mXZuki+lUplqsbZYUb i4q4cSCGphcH1XZQBuc5zw9Ua7bM5Fw2vyUJpOxX5fm+vFaD2LZP9HQTHnLBVn/0nq4L PCU4QHeMKf7r8Pu750Ri6ngAXWCPvUzj6OqLLvEzGX+reEfsftOLje8FlagKasIm7ltU 2jXXTOqsVXiktkWpaBTtJv5yX2feK2VqBhj+JeMsuuuYaD55YGzsc8zPprI5YguTjPfv Wsmw== X-Gm-Message-State: AE9vXwNWsOW6LxCOGvwp/+rASt3Wftb7mrB9I3Fg4Y8N0fA5n3tDRuoxSyHRS3b7jvKB3YDv X-Received: by 10.98.20.137 with SMTP id 131mr25043287pfu.11.1474763390944; Sat, 24 Sep 2016 17:29:50 -0700 (PDT) Original-Received: from raman-glaptop2 (c-73-170-121-60.hsd1.ca.comcast.net. [73.170.121.60]) by smtp.gmail.com with ESMTPSA id a137sm20795372pfa.72.2016.09.24.17.29.49 (version=TLS1_2 cipher=AES128-SHA bits=128/128); Sat, 24 Sep 2016 17:29:50 -0700 (PDT) In-Reply-To: <87y42gltoy.fsf@web.de> (Michael Heerdegen's message of "Sun, 25 Sep 2016 02:16:45 +0200") X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.85.192.182 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.org gmane.emacs.devel:207771 Archived-At: I'm familiar with generators as a concept across multiple languages -- but I still found the elisp docs confusing:-) We explicitly say the interface is similar to that in languages like Python -- which is why i coded up the Fibonacci example. The cl-psetq is the right idiom here in that sense -- if you use plain setq, you'd have to use a temporary variable? 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". 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. --