[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
How can I redefine REPL
The simplest way would be to use the READ-EVAL-PRINT-LOOP primitive.
You can look it up in the Help Desk. The documentation gives a brief
example template showing how you can use it.
If you can't get this to work, please provide a description of what
you tried and what went wrong. You would be better off posting here
than replying directly to me, since I am extremely busy for the next
few days.
Shriram
Jong-Kyou Kim wrote:
> 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)
> >>>>
>
>