Install Lisp on My Linux Machine

Install lisp on my linux machine

Install and learn the following things:

  • SBCL the compiler

install a binary from http://www.sbcl.org/platform-table.html Once your used to it, compile from source and keep the source around. This way you can easily jump to the definitions of functions of SBCL with M-. in Emacs.

  • Emacs

watch this screencast to see someone implementing a raytracer Raytracer in Common Lisp

  • quicklisp.lisp http://www.quicklisp.org/beta/

This is the new package management. When I started it wasn't there. Now we have it and you should use it. It makes things a lot easier.
Run 'sbcl --load quicklisp.lisp' and then enter (quicklisp-quickstart:install) press enter
and then run (ql:add-to-init-file)

  • SLIME runs within Emacs.

    Try installing it with quicklisp. Read its manual and figure out what to write into your .emacs file so that it automatically starts when you open a lisp file. Optionally watch a screencast.

  • Paredit

Seriously, you have to learn that (even if the guy in the raytracing screencast didn't use it). You should start with ( , this will make two parenthesis. With M-( you can enclose an existing s-expression. C-k cuts the s-expression behind the cursor and with C-y you can insert it anywhere.

  • ASDF

This is the make for lisp. You should learn how to define a system in an ASDF file.

  • Reference

I printed this booklet, Common Lisp Quick Reference. It's very concise.

Running LISP code via CLISP on Linux (Ubuntu WSL)

To get started, use the REPL. That is not the shell command line, but rather something like a command line inside of Lisp.

Start the Lisp system:

clisp

You get a prompt like the following:

[1]>

Load your file:

[1]> (load "intmax.lisp")

Now you can call your function:

[2]> (intmax 2 4)

And it will print:

4

And prompt again:

[3]>

You may want to learn about packages and systems later in order to organize your code.

If you want to call things from the command line, you need to tell clisp to load what is needed, then execute a lisp command. Look at the man page for that. Example:

clisp -q -i intmax.lisp -x '(intmax 2 4)'

Downloading ARC Lisp Ubuntu 16.04 Xenial

I'm not sure how to get that version of mzscheme working on your computer, but I can solve your higher-level problem of "how do I run Arc?"

The latest version of Arc, 3.1, was released in 2009. It no longer requires mzscheme 372 or earlier.

If you download 3.1, you can run Arc on top of Racket with racket -f as.scm. The install instructions on arclanguage.org have not been updated, however.

You might also want to look into anarki, a community-driven fork of Arc, which gets bugfixes and some changes. And the Arc forum has a few people posting in it, if you have other questions.

How to install new packages for common lisp without asdf-install

Short answer: Just use quicklisp.

Long answer: if you want to understand, how the package, or - more precisely - ASDF system, is laid out, that's a good idea. Actually, there's nothing hard about that.

Every ASDF system should have a system definition file with .asd extension. This file names other file of the system with their paths relative to the .asd file, their types (by default: lisp source code) and dependencies. Your Lisp should know where to find the system definition file. In ASDF there are 2 ways to inform Lisp about it: adding the directory, in which you store the file or symlink to it, to asdf:*central-registry* list or setting up special configuration files (called source-registry - more on that in ASDF manual).

Now if you want to install the system by hand, just download its sources, extract them into some directory (like in /home/user/lib/lisp/ - you may get /home/user/lib/lisp/cl-ppcre-2.3.1/, inside which there's cl-ppcre.asd). To let your Lisp find out about it just (push "/home/user/lib/lisp/cl-ppcre-2.3.1/" asdf:*central-registry*) (and don't forget the trailing slash - it's required), and then you can load the system with (asdf:oos 'asdf:load-op :cl-ppcre).

You might also setup a special dir, where you'll symlink your existing systems, like /home/user/.lisp/ and add it to *central-registry* at Lisp startup type (e.g. in .sbclrc). Now if you want to temporarily override some of the system linked in this dir, say, with a newer version, you don't need to unlink anything - just push the path to alternative system to *central-registry*.

Quicklisp does all that for you and more...



Related Topics



Leave a reply



Submit