Page 1 of 1

Sorting nil and true

Posted: Tue Jun 16, 2020 9:10 am
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

Re: Sorting nil and true

Posted: Wed Jun 17, 2020 10:01 am
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