From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Daniel Colascione Newsgroups: gmane.emacs.devel Subject: Re: Generators (iterators) for Gnu Emacs Date: Fri, 05 Dec 2014 17:08:26 -0500 Message-ID: <54822CDA.2030704@dancol.org> References: <877fy77zhp.fsf@web.de> <87lhmm24x9.fsf@gmail.com> <54812545.6030008@dancol.org> <87d27y22lp.fsf@gmail.com> <87lhmmiim7.fsf@gmail.com> <5481D080.7000206@dancol.org> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="lFLQwJDMR58tshKAwhu7exMLeEXevBwM9" X-Trace: ger.gmane.org 1417817535 16759 80.91.229.3 (5 Dec 2014 22:12:15 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 5 Dec 2014 22:12:15 +0000 (UTC) Cc: Leo Liu , emacs-devel@gnu.org To: Stefan Monnier Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Fri Dec 05 23:12:08 2014 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1Xx16c-0007qs-4G for ged-emacs-devel@m.gmane.org; Fri, 05 Dec 2014 23:12:06 +0100 Original-Received: from localhost ([::1]:52656 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Xx16Z-0008VG-I0 for ged-emacs-devel@m.gmane.org; Fri, 05 Dec 2014 17:12:03 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:56377) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Xx13G-00040U-2X for emacs-devel@gnu.org; Fri, 05 Dec 2014 17:08:39 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Xx13E-0004ph-Bb for emacs-devel@gnu.org; Fri, 05 Dec 2014 17:08:37 -0500 Original-Received: from dancol.org ([2600:3c01::f03c:91ff:fedf:adf3]:40101) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Xx13D-0004oa-Us for emacs-devel@gnu.org; Fri, 05 Dec 2014 17:08:36 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=dancol.org; s=x; h=Content-Type:In-Reply-To:References:Subject:CC:To:MIME-Version:From:Date:Message-ID; bh=THYeAWmriQQuA7VuvpFK+Ey9/kZai3OC5itGACl2Ud8=; b=Lf3HbwQjYwRsHVD73epTzg2tLTXgSBN5Juq8f2R8vjK9HUs5wjgy2z/VFrEE/ZTxEnPhIz3ONXRnh9BkQ924I5VrEejjeQnmc0XB7die6VRaNNbwACjVxybEew87vPBaRQV9xg4DlMevdAmQiGo/oc5FOORLMNOp5V4jWKNrLayEAMRxKYCe8zQZ+GQqedyjkYX9JpaXCvzLbwgMt3BdSIIPvwItdwJuPbrRV8oD9EEDqNDnL4ae7sRcZYNDwsyzbvbynoGFoVqvG34/Z94zIZr/uu31irsMEOP5G/5KR+63OiGMN9aBHWrAUzjvF3TkcIzVr5v3F13ztJ3vhHpdQQ==; Original-Received: from [2620:10d:c0a3:1003:2ab2:bdff:fe1c:db58] by dancol.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.84) (envelope-from ) id 1Xx13B-0007V1-Cf; Fri, 05 Dec 2014 14:08:33 -0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.3.0 In-Reply-To: X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2600:3c01::f03c:91ff:fedf:adf3 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 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-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:179040 Archived-At: This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --lFLQwJDMR58tshKAwhu7exMLeEXevBwM9 Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: quoted-printable On 12/05/2014 01:32 PM, Stefan Monnier wrote: >> I'd really rather signal to stop iteration. That way, it's harder to i= gnore >> end-of-iteration and loop forever and it remains possible to iterate o= ver >> *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 wor= se >> than condition-case. >=20 > The alternative I was thinking was to return a unique value, as in: >=20 > (defvar gen-eog (make-symbol "=A1end-of-generator!")) > (defun gen-eog-p (x) (eq x gen-oeg)) >=20 Right. That's the approach I don't like: now there's a value you can't en= umerate. What if you wanted to enumerate, say, the values of all symbols?= =09 --lFLQwJDMR58tshKAwhu7exMLeEXevBwM9 Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQIcBAEBCAAGBQJUgizaAAoJEN4WImmbpWBlDP4QAJCCI2oBO63DwFNwE+bEhpTA iDjtwFFcAXCeDVPVyf/C+7APipPkUzIU54RkJZ3/kgvMaglpmw1wTiEmqQr+Tf0t iK3eYSARAh6odo8F7WXNYTZmILQ0lvCdQji8K0VFVhtFE1ojgKjjQoeps5o0CaHZ 4YA7LNeZch0cTjTG8yDwNlOqJ6hmNC2CeyhBkrislg+Fdo55kYmZZWR2UHAZFyAL WHo1zLoQW9xKBD29s4dGiZbKX+aT8NqjV5dCZO64uLR1jJs5/Kx0A2CpSQ9360G9 i2PkvzWnGbXFcM393pJtcmdwelja91qr/Lx072mnVipp8aivt3xdWFGNK222hZXv JO/SN68Zqyt5zGjJ8m+LbHittS5pwQiAPzhvFpYdd13xoAISsdsuyUL+yEz23GXn ko7r0shsgDoB/6m89yM5g64Nbl0/sZfuHFK3QeCk1MfkbYpE5o71nXWQ/61VRj/G Sm3SZ40821Ow+ZODRisBkChdp8cnPDf0BgOylWudLUV7FNOCgjSIrCB3dcQdLkxA OBaN/LFIAi1RQk0DfZ0GKKmpeDtl7BQXZvSyQkfzBRBc5WgmVb8d87D/StQYObxN svxx8sdyKNfNFexEiIT0OoIC6FsU1brySPyuhwsLRtzwCBZYGdrbAYb8rAms1rny pBWIv9jXQnmxmq0jz+1m =Jp3h -----END PGP SIGNATURE----- --lFLQwJDMR58tshKAwhu7exMLeEXevBwM9--