help-gnu-emacs
[Top][All Lists]
Advanced

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

Re: About elisp, Lossing data after sort


From: Joost Kremers
Subject: Re: About elisp, Lossing data after sort
Date: 15 Mar 2007 17:21:42 GMT
User-agent: slrn/0.9.8.1 (Linux)

htbest2000 wrote:
[sort loses data]
> There something wrong in function `random-list', right? I think
> the key is: (setq list (cons (random n) list)). But I don't know
> why.

no, the problem is with the function sort. this is a destructive function,
which means that the data structure that is passed to it as an argument
gets modified. you therefore need to catch the return value of sort and
store it. see the documentation for sort in the elisp manual.

-- 
Joost Kremers                                      address@hidden
Selbst in die Unterwelt dringt durch Spalten Licht
EN:SiS(9)


reply via email to

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