Sorting nil and true

Q&A's, tips, howto's
Post Reply
cameyo
Posts: 115
Joined: Sun Mar 27, 2011 3:07 pm
Location: Italy

Sorting nil and true

Post by cameyo »

How to sort a list containing nil and true symbols?

Code: Select all

(setq a '(nil true b a))
(sort a)
;-> (nil true a b)
Thanks

cameyo
Posts: 115
Joined: Sun Mar 27, 2011 3:07 pm
Location: Italy

Re: Sorting nil and true

Post by cameyo »

I have found this method:

Code: Select all

(setq lst '(true nil true b a))
(map sym (sort (map string lst)))
;-> (a b nil true true)
cameyo

Post Reply