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: Thien-Thi Nguyen
Subject: Re: Rationalising c[ad]\{2,5\}r.
Date: Wed, 11 Mar 2015 23:15:53 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.0.50 (gnu/linux)

() 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’:

 (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))))

I wonder (idly) if the number of ‘(number-sequence 0 (1- ...))’
in the codebase justifies adding ‘iota’.  Hmmm.

-- 
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

Attachment: signature.asc
Description: PGP signature


reply via email to

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