if theres a risk that vl-sort removes duplicate elements, why not keep it safe:
- (defun mysort ( f L ) (mapcar (function (lambda (x) (nth x L))) (vl-sort-i L (function f))) )_$ (mysort (lambda (a b) (< (cadr a) (cadr b))) '((0.0 1.0 2.0) (0.0 1.0 2.0) (0.0 1.0 2.0) (1.0 2.0 3.0) (2.0 3.0 4.0)) )((0.0 1.0 2.0) (0.0 1.0 2.0) (0.0 1.0 2.0) (1.0 2.0 3.0) (2.0 3.0 4.0))_$
by using the above classical approach.
Atleast I'm paranoid on just using (vl-sort) without testing its return on certain item types. |