NLISP Code

Home

Download

Examples

FAQ

To Do

News

References

Author


NLISP FAQ

What do I need to run NLISP?

CMU Common Lisp, the GNU Scientific Library (GSL) and Gnuplot 4.0. I am assuming you are running Unix of some sort (Unix, Linux, OS X etc.). So far, I've run NLISP on OS X, Linux and Solaris 8. You're on your own if you run Windows. I have used GSL version 1.6.

If you just want to test the array syntax, it should work on any Common Lisp implementation on any platform. You don't need GSL.

Where do I get CMU CL, GSL, Gnuplot?

CMU CL is free, and can be obtained from http://www.cons.org/cmucl, gnuplot can be obtained from http://www.gnuplot.info/ and GSL can be obtained from http://sources.redhat.com/gsl/

Where's the documentation?

Look in the nlisp-0.40/doc directory for a brief installation document and a brief user guide. There's not too much as yet, but there should be enough to get you started.

Why does it only run on CMU CL?

NLISP requires ext:run-program for gnuplot. I am not sure how portable this is to other Lisps. I imagine it's a small change to put in equivalent code for another system. With version 0.40, the Foreign Function Interface (FFI) code used to call GSL and the C code to create binary gnuplot files is now written for the cffi package. This should make things much more portable. If you normally run another lisp system it should be pretty trivial to get nlisp running, as long as cffi is available for it (at the time of writing, Jan '06, this includes OpenMCL, SBCL (poss. x86 only), CLISP (v 2.35), Allegro CL, ECL and possibly Corman CL. See the cffi web page.

When will the GSL interface be finished?

Answer: Quite soon, and maybe never...

The GSL interface is in two parts. The first is a direct mapping of the GSL C functions to CMU CL. This requires cffi code to be written. This work can be automated to some extent, and I hope to finish this in the not too distant future. I am currently looking at gcc-xml to help make the cffi code. However the basic GSL interface gives a very 'procedural', C-like feel to the programming. The intention is to have a second layer that sits on top of the FFI code to GSL which packages the calls into something more NLISP like. This code cannot be automated so easily. It needs someone to sit down and think about the interface to each function (although I have managed to automate writing high-level interfaces to some of the bessel functions). I doubt if I will ever write a complete high-level NLISP GSL interface. However, it shouldn't be too hard to do this yourself for any GSL functions that you want to use. I will write some instructions and guidelines on how to do it. If you do write a function wrapper, please send it to me. I will include it in the distribution.

Why do I get all the warning messages (notes) when I compile NLISP?

They are optimisation notes. You shouldn't get any warnings. Some are notes for optimisations that can't be improved on (array size, array rank), and others are telling me that the code can go faster.

NLISP keeps printing lines like this...

; [GC threshold exceeded with 12,431,376 bytes in use. Commencing GC.]

These are garbage collector messages (cleaning up your old arrays for you). You can turn off the messages by typing

(setf ext:*gc-verbose* ())

You may also want to read the CMU CL documentation on tuning the garbage collector.

I'm sure NLISP is still consing more than it needs to. Advice welcome.

How fast is NLISP?

At present, about 4x slower than MATLAB, IDL, yorick etc. I expect it to get faster as I optimise the code, and don't see why it shouldn't equal other array based numerical packages.

Note also that CMU CL is compiled. This means that your iterative code (that would be slow on other numerical packages) will run fast in NLISP. So if you use a lot of loops, your code may run quicker on NLISP than Matlab. (Although, if you're iterating over arrays in an array based language, it usually means you're doing it wrong, but there are sometimes cases when you need to.)

What about Matlisp, Lispstat, Lush?

For one reason or another, none of the above were exaclty what I was looking for. Matlisp is probably nearest to NLISP, but I can't comment because I couldn't make it run on my Mac. (although I didn't try that hard). However, the real reason for starting a new project is just that I wanted to learn some lisp and fancied writing my own numerical lisp.

Do I need to learn LISP?

Well, it would help, although you can very quickly pick up the basics of NLISP without knowing much Lisp. NLISP uses Common Lisp arrays. You don't need to know about lists, car, cdr, conses and recursion etc. However, all the code you write in NLISP is Common Lisp code. NLISP is just three (as yet small) libraries that extend Common Lisp.

I don't think NLISP is any harder to learn than Matlab or IDL. However, you get the benefit of a full lisp system and the lisp language with Nlisp. It is my opinion that many other array-based languages (particularly IDL) tend to be a bit old-fashioned and 'FORTRAN like'. If you are a lisp programmer, I don't need to explain why you would want to use lisp for your numerical work. If you are not a lisp programmer (maybe a FORTRAN or C programmer) then maybe Nlisp will inspire you to find out what you're missing out on.

I highly recomend ANSI Common Lisp by Paul Graham.

Is NLISP ready to use?

With version 0.40, which has proper array indexing, and version 0.50 is easier to install and has more bug fixes. You should be able to use it for small projects and see it goes. But please don't bank on using Nlisp for a time critical project for a new nuclear reactor safety system! It's great for interactive use 'though, and I'm writing more and more programs (and solving more problems) in Nlisp now, rather than IDL. It's still at the stage where you might have to hack a bit 'though, but it is maturing.

Is NLISP still being actively developed?

Yes (Sept. 2006)