この特定の質問に対する特別な回答は、この質問にのみ役立つが、次の質問では役に立ちません。
質問する必要があります本当の質問は:私はどのようにCommon Lispデバッガーを使用しますか?
clispを使用しているので、clispのデバッガに精通してください。
- コマンドのリストを入手するには、
?
を試してください。
:bt
を使用してスタックトレースを取得します。この場合
:ゆっくりそれを読む
Break 1 [6]> :bt
<1/289> #<SYSTEM-FUNCTION SHOW-STACK> 3
<2/282> #<COMPILED-FUNCTION SYSTEM::PRINT-BACKTRACE>
<3/276> #<COMPILED-FUNCTION SYSTEM::DEBUG-BACKTRACE>
<4/267> #<SYSTEM-FUNCTION SYSTEM::READ-EVAL-PRINT> 2
<5/264> #<COMPILED-FUNCTION SYSTEM::BREAK-LOOP-2-3>
<6/260> #<SYSTEM-FUNCTION SYSTEM::SAME-ENV-AS> 2
<7/246> #<COMPILED-FUNCTION SYSTEM::BREAK-LOOP-2>
<8/244> #<SYSTEM-FUNCTION SYSTEM::DRIVER>
<9/204> #<COMPILED-FUNCTION SYSTEM::BREAK-LOOP>
<10/201> #<SYSTEM-FUNCTION INVOKE-DEBUGGER> 1
<11/191> #<SYSTEM-FUNCTION CAR>
[190] EVAL frame for form (CAR A1)
[186] EVAL frame for form (CONS (CAR A1) (APPEND (CDR A1) A2))
<12/183> #<SPECIAL-OPERATOR COND>
[182] EVAL frame for form (COND ((NULL A2) A1) (T (CONS (CAR A1) (APPEND (CDR A1) A2))))
[165] APPLY frame for call (APPEND '6 '"lists shuffled")
<13/160>
#<FUNCTION APPEND (A1 A2) (DECLARE (SYSTEM::IN-DEFUN APPEND))
(BLOCK APPEND
(COND ((NULL A2) A1) (T (CONS (CAR A1) (APPEND (CDR A1) A2)))))> 2
[159] EVAL frame for form (APPEND (CDR A1) A2)
[154] EVAL frame for form (CONS (CAR A1) (APPEND (CDR A1) A2))
<14/151> #<SPECIAL-OPERATOR COND>
[150] EVAL frame for form (COND ((NULL A2) A1) (T (CONS (CAR A1) (APPEND (CDR A1) A2))))
[133] APPLY frame for call (APPEND '(3 . 6) '"lists shuffled")
<15/128>
#<FUNCTION APPEND (A1 A2) (DECLARE (SYSTEM::IN-DEFUN APPEND))
(BLOCK APPEND
(COND ((NULL A2) A1) (T (CONS (CAR A1) (APPEND (CDR A1) A2)))))> 2
[127] EVAL frame for form (APPEND (MY-APPEND (CAR A1) (CAR A2)) (SHUFFLE (CDR A1) (CDR A2)))
<16/124> #<SPECIAL-OPERATOR COND>
[123] EVAL frame for form
(COND ((/= (LEN A2) (LEN A1)) (PRINC "lengths of the lists are not equal"))
((AND (NULL A1) (NULL A2)) (PRINC "lists shuffled"))
(T (APPEND (MY-APPEND (CAR A1) (CAR A2)) (SHUFFLE (CDR A1) (CDR A2)))))
[106] APPLY frame for call (SHUFFLE '(3) '(6))
<17/101>
#<FUNCTION SHUFFLE (A1 A2) (DECLARE (SYSTEM::IN-DEFUN SHUFFLE))
(BLOCK SHUFFLE
(COND
((/= (LEN A2) (LEN A1)) (PRINC "lengths of the lists are not equal"))
((AND (NULL A1) (NULL A2)) (PRINC "lists shuffled"))
(T
(APPEND (MY-APPEND (CAR A1) (CAR A2)) (SHUFFLE (CDR A1) (CDR A2))))))> 2
[100] EVAL frame for form (SHUFFLE (CDR A1) (CDR A2))
[94] EVAL frame for form (APPEND (MY-APPEND (CAR A1) (CAR A2)) (SHUFFLE (CDR A1) (CDR A2)))
<18/91> #<SPECIAL-OPERATOR COND>
[90] EVAL frame for form
(COND ((/= (LEN A2) (LEN A1)) (PRINC "lengths of the lists are not equal"))
((AND (NULL A1) (NULL A2)) (PRINC "lists shuffled"))
(T (APPEND (MY-APPEND (CAR A1) (CAR A2)) (SHUFFLE (CDR A1) (CDR A2)))))
[73] APPLY frame for call (SHUFFLE '(2 3) '(5 6))
<19/68>
#<FUNCTION SHUFFLE (A1 A2) (DECLARE (SYSTEM::IN-DEFUN SHUFFLE))
(BLOCK SHUFFLE
(COND
((/= (LEN A2) (LEN A1)) (PRINC "lengths of the lists are not equal"))
((AND (NULL A1) (NULL A2)) (PRINC "lists shuffled"))
(T
(APPEND (MY-APPEND (CAR A1) (CAR A2)) (SHUFFLE (CDR A1) (CDR A2))))))> 2
[67] EVAL frame for form (SHUFFLE (CDR A1) (CDR A2))
[61] EVAL frame for form (APPEND (MY-APPEND (CAR A1) (CAR A2)) (SHUFFLE (CDR A1) (CDR A2)))
<20/58> #<SPECIAL-OPERATOR COND>
[57] EVAL frame for form
(COND ((/= (LEN A2) (LEN A1)) (PRINC "lengths of the lists are not equal"))
((AND (NULL A1) (NULL A2)) (PRINC "lists shuffled"))
(T (APPEND (MY-APPEND (CAR A1) (CAR A2)) (SHUFFLE (CDR A1) (CDR A2)))))
[40] APPLY frame for call (SHUFFLE '(1 2 3) '(4 5 6))
<21/35>
#<FUNCTION SHUFFLE (A1 A2) (DECLARE (SYSTEM::IN-DEFUN SHUFFLE))
(BLOCK SHUFFLE
(COND
((/= (LEN A2) (LEN A1)) (PRINC "lengths of the lists are not equal"))
((AND (NULL A1) (NULL A2)) (PRINC "lists shuffled"))
(T
(APPEND (MY-APPEND (CAR A1) (CAR A2)) (SHUFFLE (CDR A1) (CDR A2))))))> 2
[34] EVAL frame for form (SHUFFLE '(1 2 3) '(4 5 6))
Printed 21 frames
。あなたは最初の10行を無視することができます。それらはclispのデバッガ自体のアーティファクトです。しかし、残りの部分はあなたのプログラムが何をしているのかを理解するでしょう。
あなたは 'append'という関数を書いています。 'append'はCommon Lisp関数であり、あなた自身で置き換えるべきではないので、名前を使うべきではありません。 Common Lispの標準ではそれも許されていないので、典型的な実装では、Lispの動作中の関数をあなた自身の試みに置き換えることによって、足で自分を撃つのを防ぐために、警告またはエラーを出すでしょう。 –