[파일명:  testSort.lsp]------------------------------------------------
(defun printArray(a)
    (format t "[")
    (loop for i from 0 below (1- (length a)) do
        (format t "~A, " (nth i a))
    )
    (if (plusp (length a))
        (format t "~A" (nth (1- (length a)) a))
    )
    (format t "]~%")
)


(setf list ext:*args*)
(sort list #'string<)
(printArray list)
------------------------------------------------


실행> clisp testSort.lsp one two three four five
[five, four, one, three, two]

실행> clisp testSort.lsp 하나 둘 셋 넷 다섯
[넷, 다섯, 둘, 셋, 하나]




Posted by Scripter
,