[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

How can I redefine REPL



Hi.

I wanted to redefine read-eval-print-loop for providing some additional
functions in REPL. I tried the following code. But when I make an error
in the expression, it automatically goes back to original REPL. Is there
any way to remain in the redefined REPL?

Thanks in advance.

Jong-Kyou Kim.

<<<<
(define (silent-repl)

  (define get-exp
    (lambda ()
      (display "question? ")
      (read)))

  (let repl ([exp (get-exp)])
    (if (eof-object? exp)
 (newline)
 (begin
   (newline)
   (write (eval exp))
   (newline)
   (repl (get-exp))))))

(silent-repl)
>>>>