Common Lisp GUI is another myth

    There is a common belief that there is no or poor graphics support in Common Lisp. This is another myth in the series that Lisp is a factorial-only language. In fact, as in most other general-purpose applications (for example, the web, data transfer formats, interacting with databases, etc.), the Lisp environment has 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 for Unix is CLX . This is an analog of xlib, i.e. low-level client that communicates directly via the X-protocol.

    In addition, there are wrappers for the main graphic frameworks of various maturity levels: LTK, CL-GTK2, CommonQt, CL-CAIRO2. Personally, I had to deal with LTK, and working with it is trivial. A good example of an application using it is the 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 there are only positive reviews. The only peculiarity is 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, 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 binders in Clozure CL.

    Specific Lisp Solutions


    The McCLIM library implements the Lisp Interface Manager specification that defines a highly developed protocol for operating with graphic primitives. Although the specification is platform-independent, the library itself is currently based on CLX with the ensuing consequences of being usable only for a Unix environment. If this is not a limitation, then you need it if you are going to write something strongly tied to graphics: a game, a graphic or CAD editor, or the new Emacs Climacs .
    Climacs

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

    conclusions


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

    PS. A few more specific graphics libraries, of course, can be found on Cliki.

    Also popular now: