A user-friendly REPL with line editing and signal handling. The default REPL provided by chibi-scheme is very minimal, meant primarily to be small and work on any platform. This module provides an advanced REPL that handles vt100 line editing and signal handling, so that C-c will interrupt a computation and bring you back to the REPL prompt. To use this repl, run
from the command line or within Emacs.Runs an interactive REPL. Repeatedly displays a prompt,
then Reads an expression, Evaluates the expression, Prints
the result then Loops. Terminates when the end of input is
reached or the
\exit command is given.
Basic Emacs-style line editing with persistent history completion is provided. C-c can be used to interrupt the current computation and drop back to the prompt. The following keyword arguments customize the REPL:
in:- the input port (default
out:- the output port (default
module:- the initial module
environment:- the initial environment (default
escape:- the command escape character (default
make-prompt:- a procedure taking one argument (the current module name as a list) and returning a string to be used as the prompt
history:- the initial command history
history-file:- the file to save history to (default ~/.chibi-repl-history)
The module: and environment: keyword arguments should not both be given.
REPL commands in the style of Scheme48
are available to control out-of-band properties. By default a
command is written as an identifier beginning with an "@"
character, but this can be customized with the
keyword. The following commands are available:
\import <import-spec>- import the
interaction-environment, useful if the
importbinding is not available
\import-only <import-spec>- replace the
interaction-environmentwith the given
\in [<module>]- switch to
<module>, or the
<module>is not specified
\meta <expr>- evaluate
\meta-module-is <module>- switch the meta module to
\exit- exit the REPL
The results of the last ten successful evaluations are available
via a history facility.
$0 holds the most recent result
$9 holds the tenth-most recent result. Evaluations
yielding single values are stored as single values while evaluations
that yield multiple values are stored as lists of values.