How to Install LISP on Linux?

LISP (List programming) is the second-oldest high-level programming language after Fortran. It has a fully parenthesized prefix notation.

Installing LISP on Linux:

Follow the below steps to install LISP on Linux:

Step 1: Install SBCL compiler.

Steel Bank Common Lisp (SBCL) is the most common Lisp compiler. It is open-source and it provides a compiler, runtime, and an interactive environment including a debugger, a statistical profiler, a code coverage tool, and many other extensions.
Install it via the following command (Enter password when prompted):

sudo apt-get update
sudo apt-get -y install sbcl

For arch linux, you can use the following command:

sudo pacman --noconfirm -S sbcl

Step 2: Now Install Quicklisp package manager

sudo apt-get -y install curl
curl -o /tmp/ql.lisp http://beta.quicklisp.org/quicklisp.lisp
sbcl --no-sysinit --no-userinit --load /tmp/ql.lisp \
--eval '(quicklisp-quickstart:install :path "~/.quicklisp")' \
--eval '(ql:add-to-init-file)' \
--quit

Step 3: Now Install the text editor or IDE of your choice

You can use any text editor for editing lisp files. Some popular options are VS code, SLIME, EMACS, Vim, etc.

Suggested extensions for VS code:

  • Common Lisp
  • Code runner
     

Example:

Here we save the file as filename.lisp eg. test.lisp. 

Lisp
(write-line "Hello w3wiki")


Navigate to the file location and run it using the command: 

sbcl --script filename.lisp
For example:
sbcl --script test.lisp

Output:


Contact Us