views:

2574

answers:

7

I'm using Emacs, with CLISP and Slime, and want to be able to draw pictures on the screen. I'm specifically thinking about drawing graphs, but anything that would let me draw basic shapes and manipulate them would be able to get me started.

+2  A: 

You could switch from CLISP to the free LispWorks Personal Edition and use the CAPI Graphics Ports drawing API.

Or you could use Lisp's Foreign Function Interface and use one of the graphics toolkits available for your OS.

Doug Currie
+5  A: 

Doug is right CAPI will work find the other things you can try cltk : http://www.cliki.net/Lisp-Tk

I know that Allegro has something for Windows programming also, but I never had tried it.

What may also work is cells-gtk: http://common-lisp.net/project/cells-gtk/

again I just can tell it exists but not how bad or even if it really works....

I can not commment also on the quality of http://www.cliki.net/GTK%20binding

But that's mostly that there is.

Corman Lisp probably has something to offer for Windows programming also.

Anyway the choices on Windows are more or less relativly slim. The highest confidence you can have it probably with CAPI, it's used for the LispWorks IDE on (Windows, Linux, MacOS X and on quite few big unices also....

Regards

Friedrich
+4  A: 

I think I've found my own answer. Clojure seems to have everything I was looking for, just because I can now use all of the Java GUI items natively in LISP. It is a different dialect of LISP than the Common-Lisp I was using, but seems to have a lot of community support, and integrates with my Windows installation of Emacs either through SLIME or through the Inferior-Lisp interpreter. So far I've been very impressed.

Oh, a code sample:

(. javax.swing.JOptionPane (showMessageDialog nil "Hello World"))

Any guesses what this does? :)

Bill Clementson's blog has quite a bit on Clojure, including a lot of helpful posts on installing it. See here: his posts on Clojure

Andrew Larned
+1  A: 

Clojure is an excellent Lisp, and Swing is a solid (if not particularly visually exciting) windowing toolkit. If you want do do more advanced graphics and/or dabble with game programming you might want to check out Slick, which is a general purpose graphics/game library that sits on top of Swing and gives you access to OpenGL and lots of other stuff.

I've found the Clojure/Slick combination an excellent way to do exploratory graphics programming, as you can interact with the graphics window directly from the REPL.

fred-o
+2  A: 

For rolling your own (like you said, basic shapes) try Lispbuilder-SDL or one of the cl-cairo FFIs (it's just my guess that the latter work with MS Windows, though).

skypher
+1  A: 

There's cl-cairo2 - a binding to Cairo vector drawing library. It can be used to draw various pictures on various surfaces. There's a cl-2d library that uses cl-cairo2 to draw charts.

And there's cl-gtk2 - a binding to Gtk+ library. You can create widgets that are drawn with cl-cairo2 (or cl-2d) that draw what you want.

dmitry_vk
+1  A: 

I know this is an old post, but so the information is here for others like me who find this thread looking for the same thing.

This library for tk bindings in common lisp seems to work fairly well. http://www.peter-herth.de/ltk/

Andrew Myers