Article illustration 1

In an era dominated by graphical interfaces, terminal applications remain indispensable for developers, sysadmins, and power users. Enter Tuition, a new Common Lisp library that brings the elegance of The Elm Architecture (TEA) to terminal UI development. By combining functional reactive principles with Common Lisp's Object System (CLOS), Tuition offers a structured approach to building responsive, stateful terminal applications.

The Architecture: TEA Meets CLOS

Tuition implements a strict Model-View-Update pattern:

  • Model: A CLOS object representing application state
  • Messages: CLOS classes defining events (keypresses, mouse actions, timers)
  • Update: Generic methods transforming state in response to messages
  • View: Pure functions rendering state as styled terminal output

This architecture enables predictable state management while leveraging Lisp's dynamic dispatch capabilities. As creator Anthony Green explains, "Specializing tui:update-message by message class provides clarity and extensibility that resonates with Lisp's strengths."

Terminal Power Without the Pain

Tuition abstracts low-level terminal complexities:

(tui:with-raw-terminal (:alt-screen t :mouse :cell-motion)
  (tui:render-border (tui:make-border :style tui:*border-rounded*) 
                     "Clean Terminal Management"))

The library handles:
- Raw mode and alternate screen buffers
- Cross-platform input decoding (including modifier keys)
- Mouse event processing at varying granularities
- Cursor control and screen refreshing

Rich Styling and Layout Toolkit

Tuition provides a comprehensive utility suite for crafting interfaces:

  • Text Styling: Nestable ANSI attributes (bold/italic/colors)
    (tui:colored (tui:bold "Critical Alert") :red)
  • Layout Engine: Compositional alignment helpers
    (tui:join-vertical tui:+center+ 
                      (render-header) 
                      (render-content))
  • Borders: Multiple styles (rounded, double, markdown-compatible)
  • Reflow Tools: Wrapping, truncation, and indentation utilities

Reactive Components and Zones

Prebuilt components simplify common UI patterns:

;; Interactive text input
(defparameter *input* (tuition.components.textinput:make-textinput))

;; Progress indicator
(tuition.components.progress:progress-view 
  (make-progress :percent 0.75))

The innovative zone system enables advanced mouse interactions by mapping screen regions to stable identifiers. This facilitates features like clickable lists and hover effects without manual coordinate math.

Why This Matters for Lisp Developers

Tuition fills a critical gap in Common Lisp's toolkit ecosystem. While languages like Go have libraries like Bubble Tea, Lisp lacked a comparable terminal framework. By implementing TEA with CLOS:

  1. State Management: Encapsulation via CLOS objects prevents spaghetti code
  2. Concurrency Model: Asynchronous commands enable non-blocking I/O
  3. Extensibility: Custom messages and generic methods allow gradual complexity
  4. Pure Rendering: Functional views simplify testing and debugging

"The marriage of TEA's discipline with Lisp's expressiveness creates something uniquely powerful," observes a Lisp veteran. "You get the architecture benefits without sacrificing Lisp's interactive development."

The Future of Terminal UX

Article illustration 2

With MIT licensing and active development, Tuition signals renewed interest in sophisticated terminal applications. As cloud infrastructure and DevOps tooling proliferate, developers increasingly need rich terminal interfaces for debugging, monitoring, and administration. Tuition positions Common Lisp as a compelling option for building these tools with maintainable architecture.

The library's component system—inspired by Charmbracelet's Bubbles—already includes spinners, progress bars, and tables, with more planned. For developers tired of terminal UI boilerplate, Tuition offers a structured path to creating durable, expressive applications that leverage decades of Lisp wisdom.

"Tuition handles terminal concerns so you can focus on application logic. It's architecture-first terminal development." - Library Documentation