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: Thierry Volpiatto
Subject: Re: can `shuffle-vector' be moved?
Date: Fri, 13 May 2011 08:19:00 +0200
User-agent: Gnus/5.110018 (No Gnus v0.18) Emacs/24.0.50 (gnu/linux)

Ted Zlatanov <address@hidden> writes:

> I don't know where it should live, but cookie1.el doesn't seem like the
> right place.
>
> It should be documented in "(elisp) Vector Functions" as well.
>
> Let me know if I should do this, please.
>
> 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)))))

Nice.
Why is this limited to vectors? with elt it could work also with lists.

> Can it go into cl-macs.el?
>
> Thanks
> Ted
>
>
>

-- 
A+ Thierry
Get my Gnupg key:
gpg --keyserver pgp.mit.edu --recv-keys 59F29997 




reply via email to

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