[Openmcl-devel] Clozure/Lisp newbie question

Gerry Weaver gerryw at compvia.com
Thu Apr 12 16:46:53 PDT 2012

Hi Pascal,

Wow!! I really appreciate your help!! This took you some time to type up. Thanks for such a great description of the options available. I am reading up on adsf and quicklisp.

Thanks Again,

From: openmcl-devel-bounces at clozure.com [openmcl-devel-bounces at clozure.com] on behalf of Pascal J. Bourguignon [pjb at informatimago.com]
Sent: Thursday, April 12, 2012 5:06 PM
To: openmcl-devel at clozure.com
Subject: Re: [Openmcl-devel] Clozure/Lisp newbie question

Gerry Weaver <gerryw at compvia.com> writes:

> What is the best way to move code between platforms or
> implementations? Do you just move the source files and load them into
> the target image? I'm still trying to get my brain wrapped around the
> image thing.
> Thanks for your responses. They are very helpful to a newbie trying to get started.


You may indeed use a simple approach, using raw tools.

So let's say you have three files:

    packages.lisp      -- contains defpackage forms.
    macros.lisp        -- contains defmacro forms
    functions.lisp     -- contains defun forms.

you can write a simple loader.lisp file:

    loader.lisp        -- contains instruction to build the program.


(dolist (file '("package" "macros" "functions"))
   (load (compile-file file)))


This ensures the simple dependency graph:

    packages <-- macros <-- functions

meanings that to compile macros.lisp, you must have compiled and loaded
packages.lisp, since macros.lisp contains a (in-package :you-package)
form, and to compile functions.lisp, you must have compiled and loaded
macros.lisp, since functions.lisp contains calls to macros defined in

So you have those four files in a directory named project, and indeed,
you may simply do:

    scp -r project/ user at remote:~/project
    ssh user at remote
    cd ~/project
    (load "loader.lisp")

But if you have more files, it will soon become boring recompiling
everything everytime. You want something like make(1), which  compiles
only the files it needs depending on the changes you make. So if you
change macros.lisp,  you need to recompile it and functions.lisp, but
not packages.lisp.

For this you'd use asdf.

Then since you're working on different computers, it will become
difficult to track what you've changed on one computer or on another, so
you will wnat to use a SCM.  A lot of people use git nowadays. For some
uses, I also like fossil http://fossil-scm.org/ (it can import and
export from git repositories).  You will need to setup a server to store
a common repository (either a http or git server), or you may use a
public git server. I use gitorious or my own servers but a lot of people
use github.

Furthermore, your programs may need to use libraries, and an easy way to
install a lisp library, with all its dependencies, is to use quicklisp.


http://gitorious.org/                  -- notice a pattern?




So finally your workflow would be:

cd ~/project RET
emacs RET
M-x slime RET
(ql:quickload :your-program)
;; (loop while bugs do enter slime debugger, debug, correct sources)
,restart -- to restart with a fresh image.
(ql:quickload :your-program)
;; check that everything's ok.
M-x shell RET
git add ${new_files_you_ve_added}
git commit -a -m ${commit_message}
git push
xterm -e ssh -X -Y user at remote RET
emacs RET
M-x shell RET
cd ~/project RET
git pull
M-x slime RET
(ql:quickload :your-program)


__Pascal Bourguignon__                     http://www.informatimago.com/
A bad day in () is better than a good day in {}.

Openmcl-devel mailing list
Openmcl-devel at clozure.com

More information about the Openmcl-devel mailing list