mirror of
https://github.com/SSCLI/sscli_20021101
synced 2026-06-08 12:28:57 +00:00
9fa3874800
Moved the original file to the archive subfolder.
28 lines
730 B
Common Lisp
28 lines
730 B
Common Lisp
(defun Length (LIST) (if (null LIST)
|
|
0
|
|
(+ 1 (Length (cdr LIST)))))
|
|
|
|
(defun Remove (L e)
|
|
(do ((lst L (cdr lst))
|
|
(c (if (= (car lst) (car e)) 'NIL (car lst))
|
|
(if (= (car lst) (car e)) c (cons c (car lst)))))
|
|
((null lst) c)
|
|
((= (car lst) (car e))
|
|
(cons c (cdr lst)))))
|
|
|
|
(defun Sort (X)
|
|
(do ((lst X (Remove lst (do ((lst1 lst (cdr lst1))
|
|
(min (car lst) (if (< (car min) (car lst1)) min (car lst1))))
|
|
((null (cdr lst1))
|
|
min))))
|
|
(count (Length X) (- count 1))
|
|
(Srt 'NIL (cons Srt min)))
|
|
((= count 0)
|
|
Srt)))
|
|
|
|
|
|
(Sort '(5 1 10))
|
|
|
|
(Sort '(-11 8 15 67 19 11 10 9 8 7 1 100 200 300 6 5 0 4 3 2 1 0))
|
|
|