[Top][All Lists]

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

Re: can `shuffle-vector' be moved?

From: Ted Zlatanov
Subject: Re: can `shuffle-vector' be moved?
Date: Thu, 12 May 2011 22:53:20 -0500
User-agent: Gnus/5.110018 (No Gnus v0.18) Emacs/24.0.50 (gnu/linux)

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.


reply via email to

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