emacs-devel
[Top][All Lists]
Advanced

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

Re: can `shuffle-vector' be moved?


From: Kevin Rodgers
Subject: Re: can `shuffle-vector' be moved?
Date: Fri, 13 May 2011 00:00:53 -0600
User-agent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.4; en-US; rv:1.9.2.17) Gecko/20110414 Thunderbird/3.1.10

On 5/12/11 9:53 PM, Ted Zlatanov wrote:
On Fri, 13 May 2011 10:03:57 +0800 Leo<address@hidden>  wrote:

L>  On 2011-05-13 03:58 +0800, Ted Zlatanov wrote:
Also this loop call from Pascal Bourguignon is a nice CL alternative to
`shuffle-vector', though it uses the same algorithm:

(defun shuffle (vector)
"Re-orders randomly the vector."
(loop
for i from (1-  (length vector)) downto 1
do (rotatef (aref vector i) (aref vector (random i)))))

Can it go into cl-macs.el?

L>  We should have one version and not in cl-macs.el.

Why?  There are many functions in cl-macs.el that have analogues in
plain ELisp.  If anything I would drop `shuffle-vector' :)

L>  `shuffle' is not in common lisp.

I didn't say it was.  cl-macs.el is not Common Lisp by any means and IMO
should not be treated as a clone of it.

From cl-macs.el:

;; These are extensions to Emacs Lisp that provide a degree of
;; Common Lisp compatibility, beyond what is already built-in
;; in Emacs Lisp.
...
;; This file contains the portions of the Common Lisp extensions
;; package which should be autoloaded, but need only be present
;; if the compiler or interpreter is used---this file is not
;; necessary for executing compiled code.

--
Kevin Rodgers
Denver, Colorado, USA




reply via email to

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