lithp is less library: the smallest set of Common Lisp
add-ons that measurably shrinks application code — five plain
constructs plus a handful of utilities, ~130 lines total, no
reader macros, no dependencies. Found by ablation: we wrote
the same machine-learner four ways and kept only what paid
rent. The why, the data, and the style rules are in
blog.md — this file is just the manual.
git clone https://github.com/aiez/optimiz # access test data
git clone https://github.com/aiez/lithp && cd lithp
sbcl --script fft.lisp # the sweet-spot version
sbcl --script fft.lisp --trees # show all grown trees
sbcl --script fft.lisp --grows # timing benchmarkSections: NAME | SYNOPSIS | KIT | UTILITIES | FILES | LICENSE
Files: lithp.lisp | blog.md | fft.lisp | small.lisp | to_small.lisp | yuck.lisp | tiny.lisp | tiny.vim | Makefile
lithp — less library: the pay-rent subset (130 lines, no deps)
(load "lithp.lisp")
(defvar *settings* '((seed . 1234567891) (file . "data.csv")))
(defmacro my (k) `(cdr (assoc ',k *settings*)))
(cli *settings*) ; -s 42 on argv updates seed
(setf *seed* (my seed))
| form | meaning |
|---|---|
(fn expr) |
variadic lambda; refer to args as $1..$9 as used |
(? x a b) |
quoted-key chained access: (ats (ats x 'a) 'b) |
(let+ (...) ...) |
one binder: (x 1) let, ((a b) lst) destructure, (f (z) ...) local fn |
(o 'k1 v1 'k2 v2) |
build equal-hash record |
(ats x k) |
read hash or struct slot uniformly; setf-able |
Plus (keys h) — list of hash keys.
| group | functions |
|---|---|
(cat ...) strings together; (prn fmt args...) format + newline |
|
| pick | (least lst f) / (most lst f) — min/max by key fn |
| parse | (thing s) string→number/symbol; (cells s) split csv line; (csv file) rows of things |
| cli | (args) argv; (cli alist) -x val sets first-char-matching key |
| random | (rand n) (rint n) (shuffle lst) (few lst n) — seeded Park-Miller (*seed*), reproducible across languages |
| file | what |
|---|---|
lithp.lisp |
this library |
blog.md |
the ablation study: why these and only these |
yuck.lisp |
naive CLOS port, 605 lines — the cautionary tale |
small.lisp |
plain ANSI CL, design only, 261 lines |
fft.lisp |
+ the kit, 240 lines — the sweet spot |
to_small.lisp |
+ reader macros via tiny.lisp, 214 lines — fun, not leverage |
tiny.lisp / tiny.vim |
the full dialect and its required editor support |
All four programs (fft, small, to_small, yuck) produce byte-identical output
(same seeded RNG as the Python original they port).
MIT. (c) 2026 Tim Menzies, timm@ieee.org