ListTalk

An experimental Lisp-family language and virtual machine written in C, with Scheme-like forms, Smalltalk-style message sends, classes, macros, modules, conditions, restarts, and an embedding API.

(define-class Point (Object) (x y))

(define-constructor [Point newX: x y: y]
  (set! .x x)
  (set! .y y)
  self)

(define-method [Point magnitude]
  (sqrt (+ (* .x .x) (* .y .y))))

Language

Reads Lisp-style S-expressions and adds bracket syntax for message sends such as [object selector: value].

Runtime

Includes native classes for objects, packages, lists, vectors, numbers, streams, weak references, conditions, restarts, and date/time values.

Embedding

Builds listtalk for the REPL and scripts, plus libListTalkVM for C applications and native modules.

Syntax at a glance

ListTalk starts with Scheme/CL-style forms, then adds compact message-send, closure, and slot-access notation.

S-expressions

(define (square x)
  (* x x))

(square 12)

Message sends

[object selector]
; expands to
(send object :selector)

[object at: key put: value]
; expands to
(send object :at:put: key value)

Slot shorthand

(define-method [Point moveX: dx y: dy]
  (set! .x (+ .x dx))
  (set! .y (+ .y dy))
  self)

Closure shorthand

{foo}
; expands to
(lambda () foo)

{arg (+ arg 1)}
; expands to
(lambda (arg) (+ arg 1))

Lambda lists

(lambda (x y :optional scale :rest more)
  (list x y scale more))

(lambda (path :key mode)
  [path openWithMode: mode])

Packages and keywords

:ready
ListTalk:command-line
http://example.org/ns:name

Build from source

ListTalk uses Meson and Ninja. The implementation is under active development, so treat the language and C API as unstable.

git clone https://github.com/ListTalk/ListTalk.git
cd ListTalk
meson setup build
meson compile -C build
meson test -C build
./build/listtalk