Next: , Previous: , Up: iklib   [Index]


6.18 Cafe

The following bindings are exported by the library (vicare).

Function: new-cafe
Function: new-cafe eval

Start a new read–eval–print loop (REPL) inside the current cafe (if one exists). It prompts the user for an expression, evaluates it, prints the result back, and repeats the process. If new-cafe is called with an argument, eval, then that argument must be a procedure that takes a single argument; the eval procedure will be used to evaluate the expressions.

Every time a new cafe is started, the prompt is changed to reflect the depth of the current cafe (i.e. how many eof objects is takes to exit the outermost cafe).

When the readline interface is not used: input is performed from the port returned by console-input-port; output is performed through the port returned by console-output-port). When readline support is available and used: the REPL input is performed through a readline input port.

If an error occurs during reading, evaluating, or printing an expression, then the error message is printed to the error–port and the operations of the cafe resume as normal.

To exit from a cafe we can write the EOF object.

Parameter: waiter-prompt-string

The string used as prompt for cafe.

Parameter: cafe-input-port

A textual input port used by the cafe.