⬆️ ⬇️

Common Lisp GUI - Another Myth

There is a widespread opinion that Common Lisp doesn’t have or poor graphics support. This is another myth from the series that Lisp is a language for factorial calculation only. In fact, as in most other general-purpose application fields (for example, web, data transfer formats, interaction with databases, etc.) in a Lisp environment there is a full range of libraries and toolkits for all major platforms with different levels of abstraction.



Linux / Unix



The base library for graphics from Common Lisp under Unix is CLX . This is an analogue of xlib, i.e. low-level client, directly communicating via X-protocol.



In addition, there are wrappers for the main graphic frameworks of different degrees of maturity: LTK, CL-GTK2, CommonQt, CL-CAIRO2. I personally have dealt with LTK, and working with it is trivial. A good example of an application that uses it is a simple and convenient Lisp editor / REPL ABLE .

ABLE screenshot

')

Windows



In addition to the ability to use cross-platform frameworks from the previous section, there is also LispWorks CAPI , about which only positive feedback. The only feature is that, like most professional development environments in any language under Windows, LispWorks is quite expensive (about $ 1200), and CAPI is available only in the professional version. (However, you can try it in the trial version).



There is also CL-OPENGL, which, of course, is cross-platform.



MacOS X



In addition to the Unix-libraries for MacOS X, there are good Cocoa Bindings in Clozure CL.



Specific Lisp Solutions



The McCLIM library implements the Lisp Interface Manager specification, which defines a very advanced protocol for operating with graphic primitives. Although the specification is platform-independent, the library itself is currently based on CLX, with the attendant implications of suitability only for the Unix environment. If this is not a restriction, then it is you who need it if you are going to write something strongly tied to the graphics: a game, a graphic or CAD editor, or the new Emacs Climacs .

Climacs



The original GUI approach originated in the Lisp environment is the Cells project, which transfers the spreadsheet paradigm of interdependent “cells” to a graphical interface. It has several Lisp implementations with this or that backend: CELLS-GTK, CELLTK, CELLO, and there are also ports to other languages.



findings



In general, the options are for every taste and needs. Where to begin? For a simple GUI, I would choose LTK or CL-GTK2 . Both are cross-platform. The first because of the maximum simplicity, even primitiveness. Accordingly, it is suitable for primitive applications. The second is because it is a good wrapper for a modern object-oriented graphic library, actively developing, and even with a Russian author :)



Ps. Some more more specific graphic libraries, of course, can be found on Cliki

Source: https://habr.com/ru/post/89097/



All Articles