From: Alan Mackenzie <acm@muc.de>
To: emacs-devel@gnu.org
Subject: Re: Rationalising c[ad]\{2,5\}r.
Date: Wed, 11 Mar 2015 23:00:54 +0000 [thread overview]
Message-ID: <20150311230054.GB2952@acm.fritz.box> (raw)
In-Reply-To: <87zj7jb2p2.fsf@zigzag.favinet>
Hi, Thien-Thi.
On Wed, Mar 11, 2015 at 11:15:53PM +0100, Thien-Thi Nguyen wrote:
> () Alan Mackenzie <acm@muc.de>
> () 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).
next prev parent reply other threads:[~2015-03-11 23:00 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-03-11 21:43 Rationalising c[ad]\{2,5\}r Alan Mackenzie
2015-03-11 22:00 ` Drew Adams
2015-03-11 22:54 ` Artur Malabarba
2015-03-12 1:51 ` Drew Adams
2015-03-12 9:54 ` Artur Malabarba
2015-03-12 14:01 ` Drew Adams
2015-03-12 4:34 ` Stephen J. Turnbull
2015-03-12 10:15 ` Artur Malabarba
2015-03-12 10:30 ` Alan Mackenzie
2015-03-12 14:03 ` Drew Adams
2015-03-11 22:15 ` Thien-Thi Nguyen
2015-03-11 23:00 ` Alan Mackenzie [this message]
2015-03-11 23:36 ` Thien-Thi Nguyen
2015-03-12 1:35 ` Samuel W. Flint
2015-03-12 0:52 ` Artur Malabarba
2015-03-12 8:56 ` Alan Mackenzie
2015-03-12 10:15 ` Artur Malabarba
2015-03-12 13:53 ` Stefan Monnier
2015-03-13 16:41 ` Alan Mackenzie
2015-03-13 16:47 ` Drew Adams
2015-03-13 20:38 ` Stefan Monnier
2015-03-13 21:36 ` Alan Mackenzie
2015-03-13 23:00 ` Stefan Monnier
2015-04-05 13:00 ` Alan Mackenzie
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20150311230054.GB2952@acm.fritz.box \
--to=acm@muc.de \
--cc=emacs-devel@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.