From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Alan Mackenzie Newsgroups: gmane.emacs.devel Subject: Re: Rationalising c[ad]\{2,5\}r. Date: Wed, 11 Mar 2015 23:00:54 +0000 Message-ID: <20150311230054.GB2952@acm.fritz.box> References: <20150311214324.GA2952@acm.fritz.box> <87zj7jb2p2.fsf@zigzag.favinet> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Trace: ger.gmane.org 1426114909 24366 80.91.229.3 (11 Mar 2015 23:01:49 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 11 Mar 2015 23:01:49 +0000 (UTC) To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Thu Mar 12 00:01:40 2015 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 1YVpdD-0003LT-RM for ged-emacs-devel@m.gmane.org; Thu, 12 Mar 2015 00:01:39 +0100 Original-Received: from localhost ([::1]:57344 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YVpdD-0001Dd-Ch for ged-emacs-devel@m.gmane.org; Wed, 11 Mar 2015 19:01:39 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:53643) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YVpd0-0001DA-2f for emacs-devel@gnu.org; Wed, 11 Mar 2015 19:01:26 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YVpcv-0003QB-5o for emacs-devel@gnu.org; Wed, 11 Mar 2015 19:01:26 -0400 Original-Received: from colin.muc.de ([193.149.48.1]:48630 helo=mail.muc.de) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YVpcu-0003PG-TI for emacs-devel@gnu.org; Wed, 11 Mar 2015 19:01:21 -0400 Original-Received: (qmail 86057 invoked by uid 3782); 11 Mar 2015 23:01:18 -0000 Original-Received: from acm.muc.de (pD9518360.dip0.t-ipconnect.de [217.81.131.96]) by colin.muc.de (tmda-ofmipd) with ESMTP; Thu, 12 Mar 2015 00:01:17 +0100 Original-Received: (qmail 4136 invoked by uid 1000); 11 Mar 2015 23:00:54 -0000 Content-Disposition: inline In-Reply-To: <87zj7jb2p2.fsf@zigzag.favinet> User-Agent: Mutt/1.5.23 (2014-03-12) X-Delivery-Agent: TMDA/1.1.12 (Macallan) X-Primary-Address: acm@muc.de X-detected-operating-system: by eggs.gnu.org: FreeBSD 9.x X-Received-From: 193.149.48.1 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:183794 Archived-At: Hi, Thien-Thi. On Wed, Mar 11, 2015 at 11:15:53PM +0100, Thien-Thi Nguyen wrote: > () Alan Mackenzie > () Wed, 11 Mar 2015 21:43:24 +0000 > Comments? > Bravo! > (defun gen-cXXr--make-seq (bits) > "Generate a list of all integers with BITS bits, in ascending order." > (let ((x (lsh 1 bits)) > acc) > (while (> x 0) > (setq x (1- x)) > (push x acc)) > acc)) > You can save some lines by using ‘number-sequence’: Thanks, I didn't know about `number-sequence'. I'll start using it. Just one thing, though, since `number-sequence' is also defined in subr.el, I'd have to wrap it in `eval-and-compile' to be able to use it in my macros. > (defun gen-cXXr--make-seq (bits) > "Generate a list of all integers with BITS bits, in ascending order." > (number-sequence 0 (1- (lsh 1 bits)))) That's short enough that I might not really need the function `gen-cXXr--make-seq'. > I wonder (idly) if the number of ‘(number-sequence 0 (1- ...))’ > in the codebase justifies adding ‘iota’. Hmmm. `iota'? A Greek letter, or a tiny amount. I'm afraid you've lost me. ;-) > -- > Thien-Thi Nguyen > GPG key: 4C807502 > (if you're human and you know it) > read my lisp: (responsep (questions 'technical) > (not (via 'mailing-list))) > => nil -- Alan Mackenzie (Nuremberg, Germany).