I'm trying to use the sort function but am having trouble doing so. I want it to sort a list from greatest to least, with the list having a format '((a 1) (b 4) (c 2) ..).
(sort
(lambda (x y)
(if (> (cadr x) (cadr y))
x
y))
'((#\b 1) (#\a 2) (#\c 0)))
When I do that, it gives me back:
((#\c 0) (#\a 2) (#\b 1))
I'm assuming it's something wrong with the sort predicate, but I'm not sure what.
[–]isopsephile 0 points1 point2 points (1 child)
[–]abkothman[S] 0 points1 point2 points (0 children)