; (read) の読み込みによってシンボルの大文字小文字の区別が失われるので ; デフォルトで :upcase になっている readtable を更新しなければいけない ; (*readtable* (copy-readtable nil)) ; で readtable のコピーをとっておき ; (setf (readtable-case *readtable*) :preserve) ; で区別をつけるようにする ; https://cl-community-spec.github.io/pages/Effect-of-Readtable-Case-on-the-Lisp-Reader.html ; https://cl-community-spec.github.io/pages/Examples-of-Effect-of-Readtable-Case-on-the-Lisp-Reader.html (defun main (&rest argv) (declare (ignorable argv)) (let* ((n (read)) (*readtable* (copy-readtable nil))) ; https://cl-community-spec.github.io/pages/readtable_002dcase.html (setf (readtable-case *readtable*) :preserve) ; ここで読み込まれるシンボルは大文字小文字の区別がついている (let ((sn (loop repeat n collect (read))) (tn (loop repeat n collect (read)))) (loop for i below n for a in sn for b in tn while (eql a b) finally (princ (1+ i)) (terpri) (princ a) (terpri) (princ b) (terpri))))) (main)