You should have said at the 1st post want to sort up to 5 items deep in a list.
I had this task for something else I did. Hopefully this is a dummy of what your after. it is amost instant to make 10000 items and sort them. I apoligise I forget where I got the complex sort from regarding authors name.
; sort on up to 5 items in sub lists
; By AlanH
(defun compare-elements (a b sortspec)
((lambda (x y test)
(if (and (equal x y ) (cdr sortspec))
(compare-elements a b (cdr sortspec))
(apply test (list x y))
)
)
(nth (cdar sortspec) a)
(nth (cdar sortspec) b)
(caar sortspec)
)
)
(defun complex-sort (alst sortspec)
(vl-sort alst
'(lambda (a b)
(compare-elements a b sortspec)
)
)
)
;; Rand - Lee Mac
;; PRNG implementing a linear congruential generator with
;; parameters derived from the book 'Numerical Recipes'
(defun LM:rand ( / a c m )
(setq m 4294967296.0
a 1664525.0
c 1013904223.0
$xn (rem (+ c (* a (cond ($xn) ((getvar 'date))))) m)
)
(/ $xn m)
)
;; Random in Range - Lee Mac
;; Returns a pseudo-random integral number in a given range (inclusive)
(defun LM:randrange ( a b )
(+ (min a b) (fix (* (LM:rand) (1+ (abs (- a b))))))
)
(defun wow ( / )
(setq lst '())
(repeat 10000
(setq v1 (atoi (rtos (LM:randrange 1 1000 ) 2 0)))
(setq v2 (atof (rtos (LM:randrange 1 1000 ) 2 3)))
(setq v3 (atof (rtos (LM:randrange 1 1000 ) 2 3)))
(setq v4 (atof (rtos (LM:randrange 1 1000 ) 2 3)))
(setq v5 (atof (rtos (LM:randrange 1 1000 ) 2 3)))
(setq lst (cons (list v1 v2 v3 v4 v5) lst))
)
(setq numcols (length (car lst)))
(cond
((= numcols 1)(setq lst (complex-sort lst '((< . 0)))))
((= numcols 2)(setq lst (complex-sort lst '((< . 0) (< . 1)))))
((= numcols 3)(setq lst (complex-sort lst '((< . 0) (< . 1) (< . 2)))))
((= numcols 4)(setq lst (complex-sort lst '((< . 0) (< . 1) (< . 2)(< . 3)))))
((= numcols 5)(setq lst (complex-sort lst '((< . 0) (< . 1) (< . 2)(< . 3)(< . 4)))))
((> numcols 5)(setq lst (complex-sort lst '((< . 0) (< . 1) (< . 2)(< . 3)(< . 4)))))
)
(princ)
)
(wow)