Return-Path: X-Original-To: notmuch@notmuchmail.org Delivered-To: notmuch@notmuchmail.org Received: from localhost (localhost [127.0.0.1]) by olra.theworths.org (Postfix) with ESMTP id 2827B431FBD; Mon, 21 Dec 2009 17:23:57 -0800 (PST) X-Virus-Scanned: Debian amavisd-new at olra.theworths.org Received: from olra.theworths.org ([127.0.0.1]) by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 5QzIpCwZrpXB; Mon, 21 Dec 2009 17:23:56 -0800 (PST) Received: from yoom.home.cworth.org (localhost [127.0.0.1]) by olra.theworths.org (Postfix) with ESMTP id 3906F431FAE; Mon, 21 Dec 2009 17:23:56 -0800 (PST) Received: by yoom.home.cworth.org (Postfix, from userid 1000) id E959F254306; Mon, 21 Dec 2009 17:23:55 -0800 (PST) From: Carl Worth To: Ruben Pollan , notmuch@notmuchmail.org In-Reply-To: <877hsv6hbo.fsf@yoom.home.cworth.org> References: <20091126202347.GA16654@blackspot> <1260364206-344-1-git-send-email-meskio@sindominio.net> <20091209132446.GC23878@blackspot> <877hsv6hbo.fsf@yoom.home.cworth.org> Date: Mon, 21 Dec 2009 17:23:55 -0800 Message-ID: <87r5qnol78.fsf@yoom.home.cworth.org> MIME-Version: 1.0 Content-Type: multipart/signed; boundary="=-=-="; micalg=pgp-sha1; protocol="application/pgp-signature" Subject: Re: [notmuch] [PATCH] Added regress option to tags iterator X-BeenThere: notmuch@notmuchmail.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: "Use and development of the notmuch mail system." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 22 Dec 2009 01:23:57 -0000 --=-=-= On Wed, 09 Dec 2009 12:08:43 -0800, Carl Worth wrote: > On Wed, 9 Dec 2009 14:24:46 +0100, Ruben Pollan wrote: > > Do you like to call them regress? Should I change that? ... > > What about the functions notmuch_*_is_first? Is kind of reversed logic than > > notmuch_*_has_more, the last are true when is not reach the limit but the > > first ones are true when the limit is reached. But I think it make sense like > > that. It doesn't make sense in the case of trying to write a for loop that iterates in the reverse order. The is_first semantic doesn't give you what you want for the loop-control portion of the for loop. > I'd like a more symmetric API here. Anyone have a favorite set of names > for iterating a list in two directions? In some recent coding I needed to implement a new iterator so I had the chance to think about this some more. Here is what I came up with: New function Corresponds to existing function (if any) ------------ ----------------------------------------- move_to_first has_next has_more move_to_next advance move_to_last has_previous move_to_previous get get The semantics of those all seem clear enough to me. They provide what's necessary for all three portions of a for loop, (in either direction), and everything pairs nicely. The only downside is that the function names are a bit long in some cases, but I'm willing to live with that until someone comes up with better. Thoughts? -Carl --=-=-= Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.10 (GNU/Linux) iD8DBQFLMB+r6JDdNq8qSWgRArSAAJ49Ja9kHikoorvY/kXPqvAgbTNCCQCggdyz vrtsxqN6BecsttfhBstYQwc= =RxAS -----END PGP SIGNATURE----- --=-=-=--