Chicken » Module (chicken repl)

## Module (chicken repl)

This module provides procedures you can use to create your own Read-Eval-Print Loop (REPL).

### repl

repl #!optional EVALUATORprocedure

  Start a new read-eval-print loop. Sets the `reset-handler` so that any invocation of `reset` restarts the read-eval-print loop. Also changes the current exception-handler to display a message, write any arguments to the value of `(current-error-port)` and reset.

  If EVALUATOR is given, it should be a procedure of one argument that is used in place of `eval` to evaluate each entered expression.

  You can use `quit` to terminate the current read-eval-print loop. Encountering end-of-file also terminates the current REPL.

### repl-prompt

repl-promptparameter

  A procedure that should evaluate to a string that will be printed before reading interactive input from the user in a read-eval-print loop. Defaults to `(lambda () "#;N> ")`.

### quit

quit #!optional RESULTprocedure

  In the interpreter `quit` exits the currently active read-eval-print loop. In compiled code, it is equivalent to calling `exit`. See also the `repl` procedure.

### reset

resetprocedure

  Reset program (Invokes `reset-handler`).

### reset-handler

reset-handlerparameter

  A procedure of zero arguments that is called via `reset`. The default behavior in compiled code is to invoke the value of `(exit-handler)`. The default behavior in the interpreter is to abort the current computation and to restart the read-eval-print loop.

Previous: Module (chicken read-syntax)

Next: Module (chicken sort)