Sessions
Sessions
LispPad allows users to manage four different types of documents: for sessions, for code, for text documents, and for drawings. 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)
The expression (+ 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)
.
Session window
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.
Session inspectors
Selecting the Info button will toggle the sidebar, revealing four different selectors:
- Info will display information about the state of the Scheme interpreter.
- Libraries will show a list of all loaded libraries and allow for searching/filtering.
- Environment will show a list of all bound symbols together with the corresponding values their are bound to.
- Expressions allows users to enter Scheme expressions which are being evaluated every single time the interpreter was going through one read-eval-print loop iteration.
Here is a screenshot of the Libraries inspector:
The following screenshot showcases the Environment inspector:
Within session (and editor) windows, invoking the “View > Explain…” menu item will trigger a documentation lookup. Documentation is typically returned as a popover dialog. In the Environment inspector, documentation can also be displayed in the sidebar.