fork download
  1. (defun process-numeric-list ()
  2. (let ((data-list '(150 420 300 250 380)))
  3. (format t "元のリスト : ~A~%" data-list)
  4.  
  5. ;; copy-list でコピーを作成してからソートする
  6. (let ((sorted-list (sort (copy-list data-list) #'>)))
  7. (format t "1番目の要素 (最大値) : ~A~%" (first sorted-list))
  8. (format t "ソート後のリスト (コピー): ~A~%" sorted-list)
  9. (format t "元のリストは保持されている : ~A~%" data-list))))
  10.  
  11. (process-numeric-list)
Success #stdin #stdout 0.01s 28952KB
stdin
Standard input is empty
stdout
元のリスト : (150 420 300 250 380)
1番目の要素 (最大値) : 420
ソート後のリスト (コピー): (420 380 300 250 150)
元のリストは保持されている : (150 420 300 250 380)