Using the interpreter
LispPad allows users to manage two different types of documents, for sessions and code. Sessions are used to load, debug and execute Lisp code. A new session is created via the "File > New Session" menu item.
Each LispPad session represents a virtual machine for executing Scheme code. Users can run multiple sessions simultaneously. Sessions are isolated and cannot interact with each other. The primary means to interact with the virtual machine is the read-eval-print loop:
- Users enter Scheme code after the prompt
➤. Pressing Return will submit the code only if parenthesis are balanced. This makes it possible to write Scheme code spanning multiple lines also in the read-eval-print loop.
- The Scheme code gets compiled and executed
- The result gets printed below the prompt. Results are printed in blue.
Here is an example for an interaction with the read-eval-print loop:
➤ (+ 3 8) 11 ➤ (map fx1+ '(1 2 3 4)) (2 3 4 5)
(+ 3 8) was entered by the user and evaluates to
11. The expression entered on the
second prompt evaluates to the list
(2 3 4 5).
The session window typically looks like this:
The buttons in the toolbar have the following functionality:
- Reset discards the current state of the session and completely restarts it from scratch.
- Clear will wipe the content of the session window (the transcript) without discarding any internal state.
- Save will save the content of the session window (the transcript) into a file.
- Print will print the content of the session window (the transcript).
- Load will load a new program into the session and execute it, modifying the state of the session.
- Stop will stop the current execution of code. This is the only way to stop non-terminating loops.