Useful Common Lisp setup on PC


#1

I thought I’d share a way to comfortably work with a CommonLisp interpreter on a larger computer - applies to Linux, Windows and MacOS:

  • install GNU CommonLisp (CLISP)

  • install Sublime Editor

  • in Sublime install SublimeREPL plugin (https://sublimerepl.readthedocs.io/en/latest/)

  • in Preferences/Package Settings/SublimeREPL/Settings-Default change “show_transferred_text” to true and save

  • in Preferences/Key Bindings add the following lines to the user part of the settings and save:

    [
    { “keys”: [“ctrl+alt+b”], “command”: “repl_transfer_current”, “args”: {“scope”: “selection”}}
    ]

  • set Sublime Layout to 2 columns (View/Layout/Columns: 2)

  • set Tools/Build System to “sublimerepl_build_system_hack”

  • in one editor column open Tools/SublimeREPL/Common Lisp/GNU Clisp

  • in other column type in your Lisp code (or load a Lisp file), make sure your View/Syntax is set to Lisp and select your code

  • press Ctrl+Alt+b - your selection is transferred to the REPL and evaluated (you may also use several other ways to transfer your code to the running CLISP interpreter - see Tools/SublimeREPL/Eval in REPL)

Looks like a long list of steps, but it’s not really complicated. The result is a nice lightweight setup with a split screen, one half showing the REPL results, the other one offering an editor panel. Very similar to the common “R” language setup using RStudio.

— EDIT: Works exactly the same way with SBCL as well (Steel Bank CommonLisp), just choose Tools/SublimeREPL/Common Lisp/SBCL as your REPL.
To add graphics, you may use “Sketch”: https://github.com/vydd/sketch
Needs some libraries to be installed beforehand, but works like a charm then.


#2

GNU Common Lisp is not a very compliant implementation and it’s also pretty slow (it was also kind of dead last time I checked a few years ago). SBCL is probably the forerunner for both compliance and speed (it compiles functions as they’re added). As far as hooking into the REPL and live programming, SLY or SLIME in Emacs is the common method. There is a Lem editor for CL but it is still fairly young. CLOG Is a browser based Common Lisp environment.

The typical route is
Install emacs
install SBCL
Install quicklisp
Install sly or slime from emacs package manager

I would not recommend using Common Lisp outside Emacs or one of the other methods above because you’ll only get lexical analysis of the code - the same terrible situation that Clojure is in with IntelliJ and Cursive.