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:25 -0500 Message-ID: <54822CD9.1000708@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="eG5iDjHdcaem0N4Rn1F2MuXwm36DRKBMU" X-Trace: ger.gmane.org 1417817479 15953 80.91.229.3 (5 Dec 2014 22:11:19 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 5 Dec 2014 22:11:19 +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:11:13 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 1Xx15l-0007Lm-Kg for ged-emacs-devel@m.gmane.org; Fri, 05 Dec 2014 23:11:13 +0100 Original-Received: from localhost ([::1]:52649 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Xx15l-0007G9-1P for ged-emacs-devel@m.gmane.org; Fri, 05 Dec 2014 17:11:13 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:56381) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Xx13G-00040a-3X 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-0004pt-Br for emacs-devel@gnu.org; Fri, 05 Dec 2014 17:08:38 -0500 Original-Received: from dancol.org ([2600:3c01::f03c:91ff:fedf:adf3]:40099) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Xx13D-0004oX-UX 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=6yPIbvwUYPBdJXGsht2AgMi+1pozN6FhLdIlSgt6gRw=; b=MmPiB2bAZL4WCSDxFHeWpREp9GgfP4ji6tzUjA0RIym55U6scQKfKpGAMwxBpkX3zPqzR2/Pc2mZqRYQ65wSpmlW8/btYC0P5lHVtmTXWRVw2OIaiEPvXMoOmHf0lKuo7atx1kBZhZeeANGO+CXveaUUnpe0RqkZIwsZo8U0jg71+s15+FOSYQXvKtPz9jaoP0Z7bW5pr6J0Z8GQZb0pmEQ7tEYjn12vrjdv3BrOUM5lLQbzxzilYhFVukSicNue3djuahdaC5qZvu/Na/Ryo9M1l2NzPjjE28Dre5nuXB3eGYBTc+NCJ0UiVU+oO8w+Cz4kSwqaihdcKG6MkNQO0Q==; 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-0007Uz-LJ; 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:179039 Archived-At: This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --eG5iDjHdcaem0N4Rn1F2MuXwm36DRKBMU 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 --eG5iDjHdcaem0N4Rn1F2MuXwm36DRKBMU 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----- --eG5iDjHdcaem0N4Rn1F2MuXwm36DRKBMU--