fork download
  1. (defun process-numeric-list ()
  2. ;; 可変長の数値リストを定義
  3. (let ((data-list '(150 420 300 250 380)))
  4. (format t "元のリスト: ~A~%" data-list)
  5.  
  6. ;; リストを降順にソート
  7. (let ((sorted-list (sort (copy-list data-list) #'>)))
  8.  
  9. ;; 2番目に大きい要素を表示
  10. (format t "2番目に大きい要素: ~A~%" (second sorted-list)))))
  11.  
  12. (process-numeric-list)
Success #stdin #stdout 0.02s 29092KB
stdin
Standard input is empty
stdout
元のリスト: (150 420 300 250 380)
2番目に大きい要素: 380