[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Axiom-developer] Re: learning Lisp

From: Kai Kaminski
Subject: Re: [Axiom-developer] Re: learning Lisp
Date: Mon, 05 Dec 2005 15:15:45 +0100
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (darwin)

William Sit <address@hidden> writes:

> Bill Page wrote:
>> The simplist way to "get into lisp" from within Axiom is the
>> ')fin' command. See page 1018 of the Axiom book (book2.pdf):
>> 1.10 )fin
> Ok, that gets me into Boot. I was able to type a lisp expression and it got
> evaluated. Now what? How do I read in a lisp file to evaluate a list of Lisp
> expressions? Can I create a separate name-space (without having to prefix each
> name with something like myname- )? (something like with prefix myname-?)
It gives you a Lisp prompt. The 'BOOT' indicates that you are in the
BOOT package. Packages are Common Lisp's way to avoid using 'myname-'
prefixes. They can be a bit tricky at first. I can recommend Erann
Gat's "Complete Idiot's Guide to Common Lisp Packages"

To read in a Lisp file, say foo.lisp, type in (load "foo").

> I downloaded lispbox, as recommended by you all, and installed the Windows
> version. After some tries, I got it to start runemacs.exe (there was some
> problem with paths, the usual trouble), and to a *scratch* buffer where it 
> says:
> ; This buffer is for notes you don't want to save, and for Lisp evaluation.
> ;; If you want to create a file, visit that file with C-x C-f,
> ;; then enter the text in that file's own buffer.
> I am not interested in editing in emacs (as a last resort, I can cut and paste
> into an emacs buffer), but rather how to run a process (lisp).  As far as I
> know, it is only an edit buffer. Supposedly, lisp is already running? There is
> no "prompt" to enter a lisp expression and everything I entered was treated 
> like
> text.
That is the standard Emacs scratch buffer, it has nothing to to with
Lispbox. I've never used Lispbox, but presumably type M-x slime RET
(M-x means hold down the Meta (Alt) key and then press x. After that
enter slime and hit return) will start up Slime (the *S*uperior
*L*isp *I*nteraction *M*ode for *E*macs). That will give you a REPL.

You might really want to reconsider and use Emacs for editing as
well. Not only is it fairly smart about editing Lisp code, Slime also
provides a few convenience functions. For example, pressing C-c C-c
compiles the toplevel-form the cursor is currently at. C-c C-k
compiles the current buffer and loads it. If you need documentation
for a Lisp function, put the cursor on its name and press C-c C-d
h. The easiest way to learn how to use Slime might be watching the
Slime video by Marco Baringer (see, Latest News, Slime

> I did spend some time reading help and Emacs manual, but they are all for
> editing and I got lost quickly. I tried the compile under tools and it says
The Emacs help will be mostly useless as far as using Slime is
concerned. You'll have to consult Lispbox-specific documentation. The
compile command is mostly meant for languages like C/C++, where you
use makefiles. Lisp doesn't really have the edit-compile-run cycle.

Again I would urge you to watch the Slime movie. Not only does it show
how to use Slime, it also demonstrates how Lisp works.

> Bill Page wrote:
>> I have been thinking about adding a section to the MathAction
>> web site specifically about lisp, learning lisp, lisp as
>> used in Axiom etc. If you have any ideas about this as someone
>> who knows Axiom and wants to learn more about lisp, I would
>> be very interested.
> That is a very good idea, especially the connection between lisp and Axiom.
> I think I may be a very bad example since I am very clumsy with Linux, Emacs. 
> I
> prefer to learn by trial and error once I know the mechanics of the REPL. I do
> not worry about the programming aspect or the editing aspect, only the
> interface. So, for me, I think a brief description of how the interactive loop
> goes is most important to get me started. (So under the Axiom environment, 
> Tim's
> secret mode instructions is already enough for me.) Specifically: I suggest 
> the
> page for learning lisp to include:
>  The lisp environment you recommend, and why you recommend it
>  how to start the lisp environment (including installation if not Axiom)
>  how to quit the lisp environment
Usually (quit) should do the job.

>  how to interactively enter a lisp expression to get it evaluated
>  how to read in a file of lisp expressions and get them evaluated
(load filename) usually works.

>  how to save a session and if possible, reload a saved one to continue
> (recomputing is ok)
This depends on the Lisp implementation.

>  how to compile lisp libraries and have them loaded at start
This depends on the Lisp environment and the library. Most new open
source Lisp libraries use ASDF (Another System Definition Facility) or
something similar. If ASDF is installed and loaded, loading another
library is usually as easy as typing (asdf:oos 'asdf:load-op
'my-library) (Slime supports a shortcut for this). There is even
asdf-install which can install certain libraries for
you. Unfortunately these tools cannot be used with Axiom at the
moment, because GCL doesn't support ASDF(*).

>  how to learn about lisp built-in functions
Download the Lisp HyperSpec
( As mentioned
above, Slime offers a shortcut to load the documentation for the
symbol under the cursor (either within Emacs using one of the Emacs
browser packages or in an external web browser).


reply via email to

[Prev in Thread] Current Thread [Next in Thread]