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.6070202@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="vCEth7oBNg0nUsgWWAwexqei35HvG4lfG" X-Trace: ger.gmane.org 1417817447 15306 80.91.229.3 (5 Dec 2014 22:10:47 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 5 Dec 2014 22:10:47 +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:10:41 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 1Xx15F-00076w-3o for ged-emacs-devel@m.gmane.org; Fri, 05 Dec 2014 23:10:41 +0100 Original-Received: from localhost ([::1]:52646 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Xx15E-0006WG-9P for ged-emacs-devel@m.gmane.org; Fri, 05 Dec 2014 17:10:40 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:56373) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Xx13F-00040F-To for emacs-devel@gnu.org; Fri, 05 Dec 2014 17:08:38 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Xx13E-0004pI-BT for emacs-devel@gnu.org; Fri, 05 Dec 2014 17:08:37 -0500 Original-Received: from dancol.org ([2600:3c01::f03c:91ff:fedf:adf3]:40110) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Xx13D-0004oW-VF 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=ZwmbyjTyXHVCYC/16OFknmGLLB+rJ4xpou5oEtPvNhE=; b=KU0tlbHI0FtDi8yjhJlG8LpWEvI6DCe8kXh3cWPReWNgybEmy4Tby3txrGUyvF1XYoOEmSWsVJoBFNjTd+7noAHg81s+hN20CtSOzQLHnV9Oq4O1yxBykb89Ad3CA/SnAkTqm5STkx/rdKtSza1+B7fRRGhZA4aQ225+hQRZ56cs6yUoUXs9wMVmWEulQph1fLdF2Nd9o+2QHwKp1Mj8j3qotr+URPZYKv9qxVf2RlUqL8Qlb+OZA2Iv84/2rMYX+hidddswtL2gFMiZ5djmS3drZeXb1KgL8OW/E6rolG6qZvsz+r/Ut/ItAn/l4sfs7mhR+PVK6NvRT0Or8gKTXA==; 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-0007Uy-Bm; 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:179038 Archived-At: This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --vCEth7oBNg0nUsgWWAwexqei35HvG4lfG 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 --vCEth7oBNg0nUsgWWAwexqei35HvG4lfG 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----- --vCEth7oBNg0nUsgWWAwexqei35HvG4lfG--