GUI in Common Lisp — another myth

There is a common opinion that in Common Lisp no or poor support for graphics. This is another myth from the series that Lisp is the only language for the calculation of factorials. In fact, as in most other applications in common use (e.g., web, data transfer formats, the interaction with the database, etc.) in the Lisp environment has a full range of libraries and toolkits for all major platforms with different levels of abstraction.

Linux/Unix


Basic graphics library from Common Lisp under Unix is CLX. Xlib is the analogue, i.e. a low-level client directly communicate via the X Protocol.

In addition, there is a wrapper for the core graphics frameworks of different degrees of maturity: LTK, CL-GTK2, CommonQt, CL-CAIRO2. I personally had to deal with LTK, and working with them is trivial. A good example application that uses it — a simple and convenient Lisp-editor/REPL ABLE.
ABLE screenshot

Windows


In addition to the possibility to use cross-platform frameworks from the past section, there are still LispWorks CAPI, which is only positive feedback. The only peculiarity lies in the fact that, like most professional development environments in any language for Windows, LispWorks is quite expensive (about 1200 $), and CAPI is available only in the professional version. (However, it is possible to try in the trial version).

Also have CL-OPENGL which of course cross-platform.

MacOS X


In addition to Unix libraries for MacOS X is a good Cocoa-binding in Clozure CL.

Lisp-Specific-solutions


Library McCLIM implements a Lisp Interface Manager specification that defines a very developed Protocol for the handling of graphics primitives. Although the specification is platform-independent, the library at the moment, based on the CLX with the consequences of fitness only for Unix environment. If this is not a limitation, it need you if you are going to write something heavily tied to graphics: the game graphics or CAD editor, or the new EmacsClimacs.
Climacs

Original approach to the GUI, which originated in the Lisp environment is the project Cells, which transfers the spreadsheet paradigm of interdependent "cells" on the GUI. He has several Lisp implementations of the c a particular backend: CELLS-GTK, CELLTK, CELLO, and there are ports to other languages.

Conclusions


In General, there are options for every taste and requests. Where to start? For a simple GUI I would choose LTK or CL-GTK2. Both are cross-platform. First because of maximum simplicity, even primitiveness. Accordingly, it is suitable for primitive applications. Second — because it's a good wrapper for modern object-oriented graphics library, is a rapidly growing, but still with the Russian author :)

PS. Some more specific graphic libraries, of course, can be found on Cliki
Article based on information from habrahabr.ru

Популярные сообщения из этого блога

Approval of WSUS updates: import, export, copy

The Hilbert curve vs. Z-order

Configuring a C++ project in Eclipse for example SFML application