#:g1: preplの紹介

Posted 2014-05-23 09:00:00 GMT

(LISP Library 365参加エントリ)

 LISP Library 365 の143日目です。

preplとはなにか

 preplは、David Lichteblau氏作のポータブルなREPLです。

パッケージ情報

パッケージ名prepl
Quicklisp
CLiKihttp://cliki.net/prepl
Quickdocshttp://quickdocs.org/prepl

インストール方法

(ql:quickload :prepl)

試してみる

 どんな関数があるかは、Quickdocsで確認できます。

 元は、SBCLに付属のSB-ACLREPLをポータブルにしたものとのこと。
SB-ACLREPLは、そもそもAllegro CLのREPLを真似したいということからできているので、preplは結局ポータブルなAllegro CLのREPLというところです。
利用できるコマンドは、Allegro CL風に

COMMAND          DESCRIPTION
<n>              re-execute <n>th history command
abort            Invoke ABORT restart.
aliases          show aliases
apropos          show apropos
bottom           move to bottom stack frame
bt               backtrace `n' stack frames, default all
cd               change default directory
cf               compile file
cload            compile if needed and load file
continue         continue from a continuable error
current          print the expression for the current stack frame
describe         describe an object
dirs             show directory stack
dn               NIL
error            print the last error message
exit             exit lisp
frame            print info about the current frame
help             print this help
history          print the recent history
inspect          inspect an object
istep            navigate within inspection of a lisp object
kill             kill (destroy) processes
ld               load a file
load-op          Load the specified ASDF system
load-system      Alias for load-op
local            print the value of a local variable
macroexpand      macroexpand an expression
make             Alias for load-op
package          change current package
pop              pop up `n' (default 1) break levels
popd             pop directory from stack
processes        NIL
pushd            push directory on stack
pwd              print current directory
readtable        change current readtable
reset            reset to top break level
top              move to top stack frame
trace            trace a function
untrace          untrace a function
up               NIL
zoom             print the runtime stack

といったところ。

動作

 簡単なところで本家Allegro CL 9.0(Express)と動作を比べてみます。

Allegro CL

まずは本家から。やっていることですが、

  1. Xを打ち込んで評価。未束縛なのでエラー。
    3回ネストし、一階層づつ戻る(:popコマンド)
  2. Xを打ち込んで評価。未束縛なのでエラー。
    2回ネストし、トップまで一気に抜ける(:resコマンド)
  3. Xを打ち込んで評価。未束縛なのでエラー。
    2回ネストし、バックトレース(:btコマンド)
    その後、バックトレース詳細表示(:zoomコマンド)

です。

CL-USER(1): x
Error: Attempt to take the value of the unbound variable `X'.
  [condition type: UNBOUND-VARIABLE]

Restart actions (select using :continue): 0: Try evaluating X again. 1: Use :X instead. 2: Set the symbol-value of X and use its value. 3: Use a value without setting X. 4: Return to Top Level (an "abort" restart). 5: Abort entirely from this (lisp) process. [1] CL-USER(2): x Error: Attempt to take the value of the unbound variable `X'. [condition type: UNBOUND-VARIABLE]

Restart actions (select using :continue): 0: Try evaluating X again. 1: Use :X instead. 2: Set the symbol-value of X and use its value. 3: Use a value without setting X. 4: Return to Debug Level 1 (an "abort" restart). 5: Try evaluating X again. 6: Use :X instead. 7: Set the symbol-value of X and use its value. 8: Use a value without setting X. 9: Return to Top Level (an "abort" restart). 10: Abort entirely from this (lisp) process. [2] CL-USER(3): x Error: Attempt to take the value of the unbound variable `X'. [condition type: UNBOUND-VARIABLE]

Restart actions (select using :continue): 0: Try evaluating X again. 1: Use :X instead. 2: Set the symbol-value of X and use its value. 3: Use a value without setting X. 4: Return to Debug Level 2 (an "abort" restart). 5: Try evaluating X again. 6: Use :X instead. 7: Set the symbol-value of X and use its value. 8: Use a value without setting X. 9: Return to Debug Level 1 (an "abort" restart). 10: Try evaluating X again. 11: Use :X instead. 12: Set the symbol-value of X and use its value. 13: Use a value without setting X. 14: Return to Top Level (an "abort" restart). 15: Abort entirely from this (lisp) process. [3] CL-USER(4): :pop Previous error: Attempt to take the value of the unbound variable `X'. [2] CL-USER(5): :pop Previous error: Attempt to take the value of the unbound variable `X'. [1] CL-USER(6): :pop CL-USER(7): x Error: Attempt to take the value of the unbound variable `X'. [condition type: UNBOUND-VARIABLE]

Restart actions (select using :continue): 0: Try evaluating X again. 1: Use :X instead. 2: Set the symbol-value of X and use its value. 3: Use a value without setting X. 4: Return to Top Level (an "abort" restart). 5: Abort entirely from this (lisp) process. [1] CL-USER(8): x Error: Attempt to take the value of the unbound variable `X'. [condition type: UNBOUND-VARIABLE]

Restart actions (select using :continue): 0: Try evaluating X again. 1: Use :X instead. 2: Set the symbol-value of X and use its value. 3: Use a value without setting X. 4: Return to Debug Level 1 (an "abort" restart). 5: Try evaluating X again. 6: Use :X instead. 7: Set the symbol-value of X and use its value. 8: Use a value without setting X. 9: Return to Top Level (an "abort" restart). 10: Abort entirely from this (lisp) process. [2] CL-USER(9): :res CL-USER(10): x Error: Attempt to take the value of the unbound variable `X'. [condition type: UNBOUND-VARIABLE]

Restart actions (select using :continue): 0: Try evaluating X again. 1: Use :X instead. 2: Set the symbol-value of X and use its value. 3: Use a value without setting X. 4: Return to Top Level (an "abort" restart). 5: Abort entirely from this (lisp) process. [1] CL-USER(11): x Error: Attempt to take the value of the unbound variable `X'. [condition type: UNBOUND-VARIABLE]

Restart actions (select using :continue): 0: Try evaluating X again. 1: Use :X instead. 2: Set the symbol-value of X and use its value. 3: Use a value without setting X. 4: Return to Debug Level 1 (an "abort" restart). 5: Try evaluating X again. 6: Use :X instead. 7: Set the symbol-value of X and use its value. 8: Use a value without setting X. 9: Return to Top Level (an "abort" restart). 10: Abort entirely from this (lisp) process. [2] CL-USER(12): :bt Evaluation stack:

EVAL <- ERROR <- EVAL <- TPL:TOP-LEVEL-READ-EVAL-PRINT-LOOP <- TPL:START-INTERACTIVE-TOP-LEVEL

[2] CL-USER(13): :zo Evaluation stack:

(ERROR #<UNBOUND-VARIABLE @ #x208f8bfa>) ->(EVAL X) (ERROR #<UNBOUND-VARIABLE @ #x208f818a>) (EVAL X) (TPL:TOP-LEVEL-READ-EVAL-PRINT-LOOP) (TPL:START-INTERACTIVE-TOP-LEVEL #<TERMINAL-SIMPLE-STREAM [initial terminal io] fd 0/1 @ #x201499e2> #<Function TOP-LEVEL-READ-EVAL-PRINT-LOOP> ...) [2] CL-USER(14): :exit ; Exiting

SBCL/Clozure CLでprepl

 次にSBCLとClozure。
Allegro CLとは微妙にコマンドの名前が異なり、:pop -> :abortだったりしますが同じく

  1. Xを打ち込んで評価。未束縛なのでエラー。
    3回ネストし、一階層づつ戻る(:abortコマンド)
  2. Xを打ち込んで評価。未束縛なのでエラー。
    2回ネストし、トップまで一気に抜ける(:resコマンド)
  3. Xを打ち込んで評価。未束縛なのでエラー。
    2回ネストし、バックトレース(:btコマンド)
    その後、バックトレース詳細表示(:zoomコマンド)

です。
バックトレースとzoomはちょっと何が起こっているか判断するには厳しいかなというところ

Clozure CL

Portable REPL on Clozure Common Lisp, listener.  Type :help for help.
CL-USER> x
Debugger entered for condition: #<UNBOUND-VARIABLE #x3020011DDDCD>:
  Unbound variable: X
Available restarts:
   0 [CONTINUE]               Retry getting the value of X.
   1 [USE-VALUE]              Specify a value of X to use this time.
   2 [STORE-VALUE]            Specify a value of X to store and use.
   3 [ABORT]                  Reduce debugger level (to debug level 0).
   4                          Abort to REPL
   5 [ABORT-TO-OUTMOST-REPL]  Abort to outmost REPL
   6                          Return to toplevel.
   7 [ABORT-BREAK]            #<RESTART ABORT-BREAK #x7FFFF7F665AD>
   8                          Reset this thread
   9                          Kill this thread
[1] CL-USER> x
Debugger entered for condition: #<UNBOUND-VARIABLE #x3020011D912D>:
  Unbound variable: X
Available restarts:
   0 [CONTINUE]               Retry getting the value of X.
   1 [USE-VALUE]              Specify a value of X to use this time.
   2 [STORE-VALUE]            Specify a value of X to store and use.
   3 [ABORT]                  Reduce debugger level (to debug level 1).
   4                          Retry getting the value of X.
   5                          Specify a value of X to use this time.
   6                          Specify a value of X to store and use.
   7                          Reduce debugger level (to debug level 0).
   8                          Abort to REPL
   9 [ABORT-TO-OUTMOST-REPL]  Abort to outmost REPL
  10                          Return to toplevel.
  11 [ABORT-BREAK]            #<RESTART ABORT-BREAK #x7FFFF7F665AD>
  12                          Reset this thread
  13                          Kill this thread
[2] CL-USER> x
Debugger entered for condition: #<UNBOUND-VARIABLE #x3020011D444D>:
  Unbound variable: X
Available restarts:
   0 [CONTINUE]               Retry getting the value of X.
   1 [USE-VALUE]              Specify a value of X to use this time.
   2 [STORE-VALUE]            Specify a value of X to store and use.
   3 [ABORT]                  Reduce debugger level (to debug level 2).
   4                          Retry getting the value of X.
   5                          Specify a value of X to use this time.
   6                          Specify a value of X to store and use.
   7                          Reduce debugger level (to debug level 1).
   8                          Retry getting the value of X.
   9                          Specify a value of X to use this time.
  10                          Specify a value of X to store and use.
  11                          Reduce debugger level (to debug level 0).
  12                          Abort to REPL
  13 [ABORT-TO-OUTMOST-REPL]  Abort to outmost REPL
  14                          Return to toplevel.
  15 [ABORT-BREAK]            #<RESTART ABORT-BREAK #x7FFFF7F665AD>
  16                          Reset this thread
  17                          Kill this thread
[3] CL-USER> :ab
[2] CL-USER> :ab
[1] CL-USER> :ab
CL-USER> x
Debugger entered for condition: #<UNBOUND-VARIABLE #x3020011CB60D>:
  Unbound variable: X
Available restarts:
   0 [CONTINUE]               Retry getting the value of X.
   1 [USE-VALUE]              Specify a value of X to use this time.
   2 [STORE-VALUE]            Specify a value of X to store and use.
   3 [ABORT]                  Reduce debugger level (to debug level 0).
   4                          Abort to REPL
   5 [ABORT-TO-OUTMOST-REPL]  Abort to outmost REPL
   6                          Return to toplevel.
   7 [ABORT-BREAK]            #<RESTART ABORT-BREAK #x7FFFF7F665AD>
   8                          Reset this thread
   9                          Kill this thread
[1] CL-USER> x
Debugger entered for condition: #<UNBOUND-VARIABLE #x3020011C7E0D>:
  Unbound variable: X
Available restarts:
   0 [CONTINUE]               Retry getting the value of X.
   1 [USE-VALUE]              Specify a value of X to use this time.
   2 [STORE-VALUE]            Specify a value of X to store and use.
   3 [ABORT]                  Reduce debugger level (to debug level 1).
   4                          Retry getting the value of X.
   5                          Specify a value of X to use this time.
   6                          Specify a value of X to store and use.
   7                          Reduce debugger level (to debug level 0).
   8                          Abort to REPL
   9 [ABORT-TO-OUTMOST-REPL]  Abort to outmost REPL
  10                          Return to toplevel.
  11 [ABORT-BREAK]            #<RESTART ABORT-BREAK #x7FFFF7F665AD>
  12                          Reset this thread
  13                          Kill this thread
[2] CL-USER> :res
CL-USER> x
Debugger entered for condition: #<UNBOUND-VARIABLE #x3020011C287D>:
  Unbound variable: X
Available restarts:
   0 [CONTINUE]               Retry getting the value of X.
   1 [USE-VALUE]              Specify a value of X to use this time.
   2 [STORE-VALUE]            Specify a value of X to store and use.
   3 [ABORT]                  Reduce debugger level (to debug level 0).
   4                          Abort to REPL
   5 [ABORT-TO-OUTMOST-REPL]  Abort to outmost REPL
   6                          Return to toplevel.
   7 [ABORT-BREAK]            #<RESTART ABORT-BREAK #x7FFFF7F665AD>
   8                          Reset this thread
   9                          Kill this thread
[1] CL-USER> x
Debugger entered for condition: #<UNBOUND-VARIABLE #x3020011BF07D>:
  Unbound variable: X
Available restarts:
   0 [CONTINUE]               Retry getting the value of X.
   1 [USE-VALUE]              Specify a value of X to use this time.
   2 [STORE-VALUE]            Specify a value of X to store and use.
   3 [ABORT]                  Reduce debugger level (to debug level 1).
   4                          Retry getting the value of X.
   5                          Specify a value of X to use this time.
   6                          Specify a value of X to store and use.
   7                          Reduce debugger level (to debug level 0).
   8                          Abort to REPL
   9 [ABORT-TO-OUTMOST-REPL]  Abort to outmost REPL
  10                          Return to toplevel.
  11 [ABORT-BREAK]            #<RESTART ABORT-BREAK #x7FFFF7F665AD>
  12                          Reset this thread
  13                          Kill this thread
[2] CL-USER> :bt
(PREPL::%REP-ONE)
(PREPL::REP-ONE)
(PREPL::%REPL :BREAK-LEVEL 2 :NOPRINT NIL :INSPECT NIL :CONTINUABLE NIL :NOBANNER T)
(#<Anonymous Function #x3020010F369F> #<Compiled-function PREPL:DEBUGGER #x30200118929F> #<COMPILED-LEXICAL-CLOSURE (:INTERNAL PREPL:REPL) #x3020011BA93F>)
(PREPL:REPL)
(#<Anonymous Function #x3020010F3A2F> #<COMPILED-LEXICAL-CLOSURE (:INTERNAL PREPL::CONT PREPL:DEBUGGER) #x3020011BA97F>)
(PREPL:DEBUGGER #<UNBOUND-VARIABLE #x3020011BF07D> #<Compiled-function PREPL:DEBUGGER #x30200118929F> NIL)
(CCL::BREAK-LOOP-HANDLE-ERROR #<UNBOUND-VARIABLE #x3020011BF07D> 17592100104127)
(CCL::%ERROR #<UNBOUND-VARIABLE #x3020011BF07D> NIL 17592100104127)
(CCL::%DEFAULT-UNBOUND-VARIABLE-RESTARTS 17592100104127 X)
(CCL::CHEAP-EVAL X)
(PREPL::INTERACTIVE-EVAL X)
(PREPL::%REP-ONE)
(PREPL::REP-ONE)
(PREPL::%REPL :BREAK-LEVEL 1 :NOPRINT NIL :INSPECT NIL :CONTINUABLE NIL :NOBANNER T)
(#<Anonymous Function #x3020010F369F> #<Compiled-function PREPL:DEBUGGER #x30200118929F> #<COMPILED-LEXICAL-CLOSURE (:INTERNAL PREPL:REPL) #x3020011BF61F>)
(PREPL:REPL)
(#<Anonymous Function #x3020010F3A2F> #<COMPILED-LEXICAL-CLOSURE (:INTERNAL PREPL::CONT PREPL:DEBUGGER) #x3020011BF65F>)
(PREPL:DEBUGGER #<UNBOUND-VARIABLE #x3020011C287D> #<Compiled-function PREPL:DEBUGGER #x30200118929F> NIL)
(CCL::BREAK-LOOP-HANDLE-ERROR #<UNBOUND-VARIABLE #x3020011C287D> 17592100104355)
(CCL::%ERROR #<UNBOUND-VARIABLE #x3020011C287D> NIL 17592100104355)
(CCL::%DEFAULT-UNBOUND-VARIABLE-RESTARTS 17592100104355 X)
(CCL::CHEAP-EVAL X)
(PREPL::INTERACTIVE-EVAL X)
(PREPL::%REP-ONE)
(PREPL::REP-ONE)
(PREPL::%REPL :BREAK-LEVEL 0 :NOPRINT NIL :INSPECT NIL :CONTINUABLE NIL :NOBANNER NIL)
(#<Anonymous Function #x3020010F369F> #<Compiled-function PREPL:DEBUGGER #x30200118929F> #<COMPILED-LEXICAL-CLOSURE (:INTERNAL PREPL:REPL) #x3020011DE79F>)
(PREPL:REPL)
(CCL::CALL-CHECK-REGS PREPL:REPL)
(CCL::TOPLEVEL-EVAL (PREPL:REPL) NIL)
(CCL::READ-LOOP :INPUT-STREAM #<SYNONYM-STREAM to *TERMINAL-IO* #x3020006B51DD> :OUTPUT-STREAM #<SYNONYM-STREAM to *TERMINAL-IO* #x3020006B507D> :BREAK-LEVEL 0 :PROMPT-FUNCTION #<Compiled-function (:INTERNAL CCL::READ-LOOP) (Non-Global)  #x30000052D15F>)
(CCL::RUN-READ-LOOP :BREAK-LEVEL 0)
(TOPLEVEL-LOOP)
((:INTERNAL (TOPLEVEL-FUNCTION (CCL::LISP-DEVELOPMENT-SYSTEM T))))
((:INTERNAL CCL::MAKE-MCL-LISTENER-PROCESS))
(CCL::RUN-PROCESS-INITIAL-FORM #<TTY-LISTENER listener(1) [Active] #x3020006B400D> (#<COMPILED-LEXICAL-CLOSURE (:INTERNAL CCL::MAKE-MCL-LISTENER-PROCESS) #x3020006B3B3F>))
((:INTERNAL (CCL::%PROCESS-PRESET-INTERNAL (PROCESS))) #<TTY-LISTENER listener(1) [Active] #x3020006B400D> (#<COMPILED-LEXICAL-CLOSURE (:INTERNAL CCL::MAKE-MCL-LISTENER-PROCESS) #x3020006B3B3F>))
((:INTERNAL CCL::THREAD-MAKE-STARTUP-FUNCTION))
[2] CL-USER> :zo
(PREPL::%REP-ONE)
(PREPL::REP-ONE)
(PREPL::%REPL :BREAK-LEVEL 2 :NOPRINT NIL :INSPECT NIL :CONTINUABLE NIL :NOBANNER T)
(#<Anonymous Function #x3020010F369F> #<Compiled-function PREPL:DEBUGGER #x30200118929F> #<COMPILED-LEXICAL-CLOSURE (:INTERNAL PREPL:REPL) #x3020011BA93F>)
(PREPL:REPL)
(#<Anonymous Function #x3020010F3A2F> #<COMPILED-LEXICAL-CLOSURE (:INTERNAL PREPL::CONT PREPL:DEBUGGER) #x3020011BA97F>)
(PREPL:DEBUGGER #<UNBOUND-VARIABLE #x3020011BF07D> #<Compiled-function PREPL:DEBUGGER #x30200118929F> NIL)
(CCL::BREAK-LOOP-HANDLE-ERROR #<UNBOUND-VARIABLE #x3020011BF07D> 17592100104127)
(CCL::%ERROR #<UNBOUND-VARIABLE #x3020011BF07D> NIL 17592100104127)
(CCL::%DEFAULT-UNBOUND-VARIABLE-RESTARTS 17592100104127 X)
(CCL::CHEAP-EVAL X)
(PREPL::INTERACTIVE-EVAL X)
(PREPL::%REP-ONE)
(PREPL::REP-ONE)
(PREPL::%REPL :BREAK-LEVEL 1 :NOPRINT NIL :INSPECT NIL :CONTINUABLE NIL :NOBANNER T)
(#<Anonymous Function #x3020010F369F> #<Compiled-function PREPL:DEBUGGER #x30200118929F> #<COMPILED-LEXICAL-CLOSURE (:INTERNAL PREPL:REPL) #x3020011BF61F>)
(PREPL:REPL)
(#<Anonymous Function #x3020010F3A2F> #<COMPILED-LEXICAL-CLOSURE (:INTERNAL PREPL::CONT PREPL:DEBUGGER) #x3020011BF65F>)
(PREPL:DEBUGGER #<UNBOUND-VARIABLE #x3020011C287D> #<Compiled-function PREPL:DEBUGGER #x30200118929F> NIL)
(CCL::BREAK-LOOP-HANDLE-ERROR #<UNBOUND-VARIABLE #x3020011C287D> 17592100104355)
(CCL::%ERROR #<UNBOUND-VARIABLE #x3020011C287D> NIL 17592100104355)
(CCL::%DEFAULT-UNBOUND-VARIABLE-RESTARTS 17592100104355 X)
(CCL::CHEAP-EVAL X)
(PREPL::INTERACTIVE-EVAL X)
(PREPL::%REP-ONE)
(PREPL::REP-ONE)
(PREPL::%REPL :BREAK-LEVEL 0 :NOPRINT NIL :INSPECT NIL :CONTINUABLE NIL :NOBANNER NIL)
(#<Anonymous Function #x3020010F369F> #<Compiled-function PREPL:DEBUGGER #x30200118929F> #<COMPILED-LEXICAL-CLOSURE (:INTERNAL PREPL:REPL) #x3020011DE79F>)
(PREPL:REPL)
(CCL::CALL-CHECK-REGS PREPL:REPL)
(CCL::TOPLEVEL-EVAL (PREPL:REPL) NIL)
(CCL::READ-LOOP :INPUT-STREAM #<SYNONYM-STREAM to *TERMINAL-IO* #x3020006B51DD> :OUTPUT-STREAM #<SYNONYM-STREAM to *TERMINAL-IO* #x3020006B507D> :BREAK-LEVEL 0 :PROMPT-FUNCTION #<Compiled-function (:INTERNAL CCL::READ-LOOP) (Non-Global)  #x30000052D15F>)
(CCL::RUN-READ-LOOP :BREAK-LEVEL 0)
(TOPLEVEL-LOOP)
((:INTERNAL (TOPLEVEL-FUNCTION (CCL::LISP-DEVELOPMENT-SYSTEM T))))
((:INTERNAL CCL::MAKE-MCL-LISTENER-PROCESS))
(CCL::RUN-PROCESS-INITIAL-FORM #<TTY-LISTENER listener(1) [Active] #x3020006B400D> (#<COMPILED-LEXICAL-CLOSURE (:INTERNAL CCL::MAKE-MCL-LISTENER-PROCESS) #x3020006B3B3F>))
((:INTERNAL (CCL::%PROCESS-PRESET-INTERNAL (PROCESS))) #<TTY-LISTENER listener(1) [Active] #x3020006B400D> (#<COMPILED-LEXICAL-CLOSURE (:INTERNAL CCL::MAKE-MCL-LISTENER-PROCESS) #x3020006B3B3F>))
((:INTERNAL CCL::THREAD-MAKE-STARTUP-FUNCTION))
[2] CL-USER> :exit

SBCL

Portable REPL on SBCL, main thread.  Type :help for help.
CL-USER> x

Debugger entered for condition: #<UNBOUND-VARIABLE X {100693D343}>: The variable X is unbound. Available restarts: 0 [ABORT] Reduce debugger level (to debug level 0). 1 Abort to REPL 2 [ABORT-TO-OUTMOST-REPL] Abort to outmost REPL 3 Exit debugger, returning to top level. [1] CL-USER> x

Debugger entered for condition: #<UNBOUND-VARIABLE X {100694CA03}>: The variable X is unbound. Available restarts: 0 [ABORT] Reduce debugger level (to debug level 1). 1 Reduce debugger level (to debug level 0). 2 Abort to REPL 3 [ABORT-TO-OUTMOST-REPL] Abort to outmost REPL 4 Exit debugger, returning to top level. [2] CL-USER> x

Debugger entered for condition: #<UNBOUND-VARIABLE X {1006953D93}>: The variable X is unbound. Available restarts: 0 [ABORT] Reduce debugger level (to debug level 2). 1 Reduce debugger level (to debug level 1). 2 Reduce debugger level (to debug level 0). 3 Abort to REPL 4 [ABORT-TO-OUTMOST-REPL] Abort to outmost REPL 5 Exit debugger, returning to top level. [3] CL-USER> :ab

[2] CL-USER> :ab

[1] CL-USER> :ab

CL-USER> x

Debugger entered for condition: #<UNBOUND-VARIABLE X {100695FE93}>: The variable X is unbound. Available restarts: 0 [ABORT] Reduce debugger level (to debug level 0). 1 Abort to REPL 2 [ABORT-TO-OUTMOST-REPL] Abort to outmost REPL 3 Exit debugger, returning to top level. [1] CL-USER> x

Debugger entered for condition: #<UNBOUND-VARIABLE X {1006966313}>: The variable X is unbound. Available restarts: 0 [ABORT] Reduce debugger level (to debug level 1). 1 Reduce debugger level (to debug level 0). 2 Abort to REPL 3 [ABORT-TO-OUTMOST-REPL] Abort to outmost REPL 4 Exit debugger, returning to top level. [2] CL-USER> :res

CL-USER> x

Debugger entered for condition: #<UNBOUND-VARIABLE X {100696EA63}>: The variable X is unbound. Available restarts: 0 [ABORT] Reduce debugger level (to debug level 0). 1 Abort to REPL 2 [ABORT-TO-OUTMOST-REPL] Abort to outmost REPL 3 Exit debugger, returning to top level. [1] CL-USER> x

Debugger entered for condition: #<UNBOUND-VARIABLE X {1006974F33}>: The variable X is unbound. Available restarts: 0 [ABORT] Reduce debugger level (to debug level 1). 1 Reduce debugger level (to debug level 0). 2 Abort to REPL 3 [ABORT-TO-OUTMOST-REPL] Abort to outmost REPL 4 Exit debugger, returning to top level. [2] CL-USER> :bt ((LAMBDA (CONIUM::DEBUGGER-LOOP-FN) :IN "conium-20101006-git/sbcl.lisp") #<CLOSURE (LAMBDA NIL :IN PREPL::BT-CMD) {100697973B}>) (PREPL::PROCESS-COMMAND #S(PREPL::USER-COMMAND :INPUT ":bt" :FUNC #<FUNCTION PREPL::BT-CMD> :ARGS NIL :HNUM 2)) (PREPL::%REP-ONE) (PREPL::REP-ONE) (PREPL::%REPL :BREAK-LEVEL NIL :NOPRINT NIL :INSPECT NIL :CONTINUABLE NIL :NOBANNER NIL) ((LAMBDA (CONIUM::HOOK CONIUM::FUN) :IN "conium-20101006-git/sbcl.lisp") #<FUNCTION PREPL:DEBUGGER> #<CLOSURE (LAMBDA NIL :IN PREPL:REPL) {1006977F4B}>) (PREPL:REPL) ((LAMBDA (CONIUM::DEBUGGER-LOOP-FN) :IN "conium-20101006-git/sbcl.lisp") #<CLOSURE (LAMBDA NIL :IN PREPL:DEBUGGER) {1006977F2B}>) (PREPL:DEBUGGER #<UNBOUND-VARIABLE X {1006974F33}> #<unused argument> NIL) (SB-DEBUG::RUN-HOOK *INVOKE-DEBUGGER-HOOK* #<UNBOUND-VARIABLE X {1006974F33}>) (INVOKE-DEBUGGER #<UNBOUND-VARIABLE X {1006974F33}>) (ERROR UNBOUND-VARIABLE :NAME X) (SB-KERNEL::UNBOUND-SYMBOL-ERROR-HANDLER #<unavailable argument> #.(SB-SYS:INT-SAP #X7FFFF6D9E770) #<SB-ALIEN-INTERNALS:ALIEN-VALUE :SAP #X7FFFF6D9E100 :TYPE (* (STRUCT SB-VM::OS-CONTEXT-T-STRUCT))> (1051)) (SB-KERNEL:INTERNAL-ERROR #.(SB-SYS:INT-SAP #X7FFFF6D9E100) #<unavailable argument>) ("foreign function: call_into_lisp") ("foreign function: funcall2") ("foreign function: interrupt_internal_error") ("foreign function: handle_trap") ("foreign function: #x411F4F") (SB-INT:SIMPLE-EVAL-IN-LEXENV X #<NULL-LEXENV>) (EVAL X) (PREPL::INTERACTIVE-EVAL X) (PREPL::%REP-ONE) (PREPL::REP-ONE) (PREPL::%REPL :BREAK-LEVEL NIL :NOPRINT NIL :INSPECT NIL :CONTINUABLE NIL :NOBANNER NIL) ((LAMBDA (CONIUM::HOOK CONIUM::FUN) :IN "conium-20101006-git/sbcl.lisp") #<FUNCTION PREPL:DEBUGGER> #<CLOSURE (LAMBDA NIL :IN PREPL:REPL) {1006970F0B}>) (PREPL:REPL) ((LAMBDA (CONIUM::DEBUGGER-LOOP-FN) :IN "conium-20101006-git/sbcl.lisp") #<CLOSURE (LAMBDA NIL :IN PREPL:DEBUGGER) {1006970EEB}>) (PREPL:DEBUGGER #<UNBOUND-VARIABLE X {100696EA63}> #<unused argument> NIL) (SB-DEBUG::RUN-HOOK *INVOKE-DEBUGGER-HOOK* #<UNBOUND-VARIABLE X {100696EA63}>) (INVOKE-DEBUGGER #<UNBOUND-VARIABLE X {100696EA63}>) (ERROR UNBOUND-VARIABLE :NAME X) (SB-KERNEL::UNBOUND-SYMBOL-ERROR-HANDLER #<unavailable argument> #.(SB-SYS:INT-SAP #X7FFFF6D9F580) #<SB-ALIEN-INTERNALS:ALIEN-VALUE :SAP #X7FFFF6D9EF00 :TYPE (* (STRUCT SB-VM::OS-CONTEXT-T-STRUCT))> (1051)) (SB-KERNEL:INTERNAL-ERROR #.(SB-SYS:INT-SAP #X7FFFF6D9EF00) #<unavailable argument>) ("foreign function: call_into_lisp") ("foreign function: funcall2") ("foreign function: interrupt_internal_error") ("foreign function: handle_trap") ("foreign function: #x411F4F") (SB-INT:SIMPLE-EVAL-IN-LEXENV X #<NULL-LEXENV>) (EVAL X) (PREPL::INTERACTIVE-EVAL X) (PREPL::%REP-ONE) (PREPL::REP-ONE) (PREPL::%REPL :BREAK-LEVEL NIL :NOPRINT NIL :INSPECT NIL :CONTINUABLE NIL :NOBANNER NIL) (SB-THREAD::CALL-WITH-NEW-SESSION #<CLOSURE (LABELS #:FB-NAME-2334 :IN PREPL::INVOKE-WITH-SESSION-WORKAROUND-IF-ON-SBCL) {100693926B}>) (PREPL::INVOKE-WITH-SESSION-WORKAROUND-IF-ON-SBCL #<CLOSURE (LAMBDA NIL :IN PREPL:REPL) {100693924B}>) ((LAMBDA (CONIUM::HOOK CONIUM::FUN) :IN "conium-20101006-git/sbcl.lisp") #<FUNCTION PREPL:DEBUGGER> #<CLOSURE (LAMBDA NIL :IN PREPL:REPL) {100693920B}>) (PREPL:REPL) (SB-INT:SIMPLE-EVAL-IN-LEXENV (PREPL:REPL) #<NULL-LEXENV>) (EVAL (PREPL:REPL)) (INTERACTIVE-EVAL (PREPL:REPL) :EVAL NIL) (SB-IMPL::REPL-FUN NIL) ((LAMBDA NIL :IN SB-IMPL::TOPLEVEL-REPL)) (SB-IMPL::%WITH-REBOUND-IO-SYNTAX #<CLOSURE (LAMBDA NIL :IN SB-IMPL::TOPLEVEL-REPL) {100518C87B}>) (SB-IMPL::TOPLEVEL-REPL NIL) (SB-IMPL::TOPLEVEL-INIT) ((FLET #:WITHOUT-INTERRUPTS-BODY-60 :IN SAVE-LISP-AND-DIE)) ((LABELS SB-IMPL::RESTART-LISP :IN SAVE-LISP-AND-DIE)) [2] CL-USER> :zo ((LAMBDA (CONIUM::DEBUGGER-LOOP-FN) :IN "conium-20101006-git/sbcl.lisp") #<FUNCTION (LAMBDA NIL :IN PREPL::ZOOM-CMD) {100683D88B}>) (PREPL::PROCESS-COMMAND #S(PREPL::USER-COMMAND :INPUT ":zo" :FUNC #<FUNCTION PREPL::ZOOM-CMD> :ARGS NIL :HNUM 3)) (PREPL::%REP-ONE) (PREPL::REP-ONE) (PREPL::%REPL :BREAK-LEVEL NIL :NOPRINT NIL :INSPECT NIL :CONTINUABLE NIL :NOBANNER NIL) ((LAMBDA (CONIUM::HOOK CONIUM::FUN) :IN "conium-20101006-git/sbcl.lisp") #<FUNCTION PREPL:DEBUGGER> #<CLOSURE (LAMBDA NIL :IN PREPL:REPL) {1006977F4B}>) (PREPL:REPL) ((LAMBDA (CONIUM::DEBUGGER-LOOP-FN) :IN "conium-20101006-git/sbcl.lisp") #<CLOSURE (LAMBDA NIL :IN PREPL:DEBUGGER) {1006977F2B}>) (PREPL:DEBUGGER #<UNBOUND-VARIABLE X {1006974F33}> #<unused argument> NIL) (SB-DEBUG::RUN-HOOK *INVOKE-DEBUGGER-HOOK* #<UNBOUND-VARIABLE X {1006974F33}>) (INVOKE-DEBUGGER #<UNBOUND-VARIABLE X {1006974F33}>) (ERROR UNBOUND-VARIABLE :NAME X) (SB-KERNEL::UNBOUND-SYMBOL-ERROR-HANDLER #<unavailable argument> #.(SB-SYS:INT-SAP #X7FFFF6D9E770) #<SB-ALIEN-INTERNALS:ALIEN-VALUE :SAP #X7FFFF6D9E100 :TYPE (* (STRUCT SB-VM::OS-CONTEXT-T-STRUCT))> (1051)) (SB-KERNEL:INTERNAL-ERROR #.(SB-SYS:INT-SAP #X7FFFF6D9E100) #<unavailable argument>) ("foreign function: call_into_lisp") ("foreign function: funcall2") ("foreign function: interrupt_internal_error") ("foreign function: handle_trap") ("foreign function: #x411F4F") (SB-INT:SIMPLE-EVAL-IN-LEXENV X #<NULL-LEXENV>) (EVAL X) (PREPL::INTERACTIVE-EVAL X) (PREPL::%REP-ONE) (PREPL::REP-ONE) (PREPL::%REPL :BREAK-LEVEL NIL :NOPRINT NIL :INSPECT NIL :CONTINUABLE NIL :NOBANNER NIL) ((LAMBDA (CONIUM::HOOK CONIUM::FUN) :IN "conium-20101006-git/sbcl.lisp") #<FUNCTION PREPL:DEBUGGER> #<CLOSURE (LAMBDA NIL :IN PREPL:REPL) {1006970F0B}>) (PREPL:REPL) ((LAMBDA (CONIUM::DEBUGGER-LOOP-FN) :IN "conium-20101006-git/sbcl.lisp") #<CLOSURE (LAMBDA NIL :IN PREPL:DEBUGGER) {1006970EEB}>) (PREPL:DEBUGGER #<UNBOUND-VARIABLE X {100696EA63}> #<unused argument> NIL) (SB-DEBUG::RUN-HOOK *INVOKE-DEBUGGER-HOOK* #<UNBOUND-VARIABLE X {100696EA63}>) (INVOKE-DEBUGGER #<UNBOUND-VARIABLE X {100696EA63}>) (ERROR UNBOUND-VARIABLE :NAME X) (SB-KERNEL::UNBOUND-SYMBOL-ERROR-HANDLER #<unavailable argument> #.(SB-SYS:INT-SAP #X7FFFF6D9F580) #<SB-ALIEN-INTERNALS:ALIEN-VALUE :SAP #X7FFFF6D9EF00 :TYPE (* (STRUCT SB-VM::OS-CONTEXT-T-STRUCT))> (1051)) (SB-KERNEL:INTERNAL-ERROR #.(SB-SYS:INT-SAP #X7FFFF6D9EF00) #<unavailable argument>) ("foreign function: call_into_lisp") ("foreign function: funcall2") ("foreign function: interrupt_internal_error") ("foreign function: handle_trap") ("foreign function: #x411F4F") (SB-INT:SIMPLE-EVAL-IN-LEXENV X #<NULL-LEXENV>) (EVAL X) (PREPL::INTERACTIVE-EVAL X) (PREPL::%REP-ONE) (PREPL::REP-ONE) (PREPL::%REPL :BREAK-LEVEL NIL :NOPRINT NIL :INSPECT NIL :CONTINUABLE NIL :NOBANNER NIL) (SB-THREAD::CALL-WITH-NEW-SESSION #<CLOSURE (LABELS #:FB-NAME-2334 :IN PREPL::INVOKE-WITH-SESSION-WORKAROUND-IF-ON-SBCL) {100693926B}>) (PREPL::INVOKE-WITH-SESSION-WORKAROUND-IF-ON-SBCL #<CLOSURE (LAMBDA NIL :IN PREPL:REPL) {100693924B}>) ((LAMBDA (CONIUM::HOOK CONIUM::FUN) :IN "conium-20101006-git/sbcl.lisp") #<FUNCTION PREPL:DEBUGGER> #<CLOSURE (LAMBDA NIL :IN PREPL:REPL) {100693920B}>) (PREPL:REPL) (SB-INT:SIMPLE-EVAL-IN-LEXENV (PREPL:REPL) #<NULL-LEXENV>) (EVAL (PREPL:REPL)) (INTERACTIVE-EVAL (PREPL:REPL) :EVAL NIL) (SB-IMPL::REPL-FUN NIL) ((LAMBDA NIL :IN SB-IMPL::TOPLEVEL-REPL)) (SB-IMPL::%WITH-REBOUND-IO-SYNTAX #<CLOSURE (LAMBDA NIL :IN SB-IMPL::TOPLEVEL-REPL) {100518C87B}>) (SB-IMPL::TOPLEVEL-REPL NIL) (SB-IMPL::TOPLEVEL-INIT) ((FLET #:WITHOUT-INTERRUPTS-BODY-60 :IN SAVE-LISP-AND-DIE)) ((LABELS SB-IMPL::RESTART-LISP :IN SAVE-LISP-AND-DIE)) [2] CL-USER> :exit

まとめ

 今回は、preplを紹介してみました。
REPLを良く使う人が複数の処理系を跨って利用する場合、微妙に異なるコマンド体系を統一したいという場合には便利かもしれないですね。

comments powered by Disqus