[LispM] How Good is the Genera Compiler for ANSI Common Lisp?

Steven Nunez steven.nunez at illation.com.hk
Sat Oct 21 00:38:41 PDT 2017


Greetings Gents,

 

I've started working with some common lisp libraries and noticed a number of
compiler warnings, in code that I would not expect it. For example
Alexandria shows this:

 



 

Looking for example at the function 'shuffle':

 

(defun shuffle (sequence &key (start 0) end)

  "Returns a random permutation of SEQUENCE bounded by START and END.

Original sequece may be destructively modified, and share storage with

the original one. Signals an error if SEQUENCE is not a proper

sequence."

  (declare (type fixnum start)

           (type (or fixnum null) end))

  (etypecase sequence

    (list

     (let* ((end (or end (proper-list-length sequence)))

            (n (- end start)))

       (do ((tail (nthcdr start sequence) (cdr tail)))

           ((zerop n))

         (rotatef (car tail) (car (nthcdr (random n) tail)))

         (decf n))))

    (vector

     (let ((end (or end (length sequence))))

       (loop for i from start below end

             do (rotatef (aref sequence i)

                         (aref sequence (+ i (random (- end i))))))))

    (sequence

     (let ((end (or end (length sequence))))

       (loop for i from (- end 1) downto start

             do (rotatef (elt sequence i)

                         (elt sequence (+ i (random (- end i)))))))))

  sequence)

 

I do not see any errors here, and having such a basic error in a library
like Alexandria would be surprising.

 

Does anyone have any ideas on what might be causing Genera to throw these
warnings?

 

Cheers,

*	SteveN

-------------- next part --------------
An HTML attachment was scrubbed...
URL: </archives/lispm/attachments/20171021/65eb630d/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image001.png
Type: image/png
Size: 36817 bytes
Desc: not available
URL: </archives/lispm/attachments/20171021/65eb630d/attachment-0001.png>


More information about the LispM mailing list