emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Rationalising c[ad]\{2,5\}r.


From: Alan Mackenzie
Subject: Re: Rationalising c[ad]\{2,5\}r.
Date: Wed, 11 Mar 2015 23:00:54 +0000
User-agent: Mutt/1.5.23 (2014-03-12)

Hi, Thien-Thi.

On Wed, Mar 11, 2015 at 11:15:53PM +0100, Thien-Thi Nguyen wrote:
> () Alan Mackenzie <address@hidden>
> () 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).



reply via email to

[Prev in Thread] Current Thread [Next in Thread]