Reputation: 9740
I have a list L composed from random numbers
(defvar L '(1 4 2 6 4 3 4 1 9 5))
How to order it in ascending order?
list in ascending order is: L(1 1 2 3 4 4 4 5 6 9)
Upvotes: 1
Views: 2330
Reputation: 363828
(sort L #'<)
or
(sort (copy-list L) #'<)
if you don't want to modify L
in-place. If you want to use L
afterward to get to the sorted list, rebind it:
(setf L (sort L #'<))
Upvotes: 5