Planet Scheme

Thursday, December 3, 2026

jointhefreeworld

Sift: the Lisp formatter I kept trying to write (+lint +LSP)

The story of sift: a voyage of failed attempts, ideas, that eventually came together as a formatter, linter and language server that actually reads Scheme, Racket, Emacs Lisp and Common Lisp.

It’s a solid formatter, highly configurable, got more than 95 lint rules, strong opinions, a WASM browser build, and combines with REPL workflow which makes it all feel like magic if you ask me.

This is the program I’ve been trying to write for years. I finally got it.

Find sift at https://github.com/jjba23/sift, and get a taste of it in your browser at https://jointhefreeworld.org/sift/.



The short version  #

I’ve been writing Lisp (the family of languages with all the parentheses) for a few years now, and for most of that time my tooling was a pile of workarounds if I’m being honest with you.

sift is the first tool I’ve built that feels like it understands the Lisp file instead of guessing at it.

It’s built as one Guile program: a formatter, a linter and a language server for four dialects of the mighty Lisp family: Scheme, Racket, Emacs Lisp and Common Lisp. It has right now more than 95 rules. Formatting is idempotent. It runs in your editor, your CLI, in CI (the checks that run on every push), in a container and in a browser tab. It started with a pile of failed attempts.

If you’re new to this: a formatter rewrites whitespace, a linter reports suspicious code, a language server answers an editor’s questions over LSP, and a fixed point means formatting twice gives the same bytes. A docstring is the documentation string attached to a definition. The cool part is that all three are one program, so your editor and CI always agree.

sift lint, fix and format in a terminal, then the same file in Emacs
The demo, recorded from a checkout. sift lint, sift fix --write, the formatter's diff, and the same file in Emacs with Flymake, Eglot, hover, inlay hints and formatting.

That’s the loop: the command line, the fixes, the formatter, then the same file in Emacs. The recording is real. It was captured from a checkout, not drawn by hand.

The problem  #

Lisp is a tree of nested lists. The language knows it, and most of the tooling around it pretends otherwise (some with nasty regex magic too).

In Go you have gofmt. In Rust you have rustfmt. Same program on every machine, same answe. In the Lisp world the answer is usually “my editor does it”, “the compiler warns about it”, “we have a fmt task somewhere”, or “run guix style on the package file”.

The cost shows up everywhere. Two editors disagree about indentation. CI formats the code one way and your editor another. A compiler warning is prose: no stable code, no severity, no JSON or SARIF (the data formats editors and code scanners read), no way to suppress it next to the line that caused it, and no fix. A project with Scheme, Emacs Lisp and Common Lisp needs three tools, three configs and three CI steps.

That was my situation. My projects are Guix and Guile, Emacs Lisp and a little Common Lisp; Racket is the fourth dialect sift grew into. My formatting was a maak fmt task running guix style on every .scm file and Emacs’s indent-region on every .el file. Linting was checkdoc, the byte-compiler, guild compile -W3, guix lint, stylelint, and a hand-written checker that read every .el form to prove the config still loaded. Each tool was good at its slice. None of them was the thing I wanted.

The failed attempts  #

I didn’t design sift in one go. I kept trying to solve the problem with the tools I had, and each attempt failed in a way that taught me one piece.

The keyboard macro. Before I wrote formatter code, I formatted files with a keyboard macro: tabs to spaces, trailing whitespace gone, indent-region, save, stare at the diff. Then I turned it into a sed script. It was fast, and it felt like magic for about a day. Then I hit a form whose indentation depended on what the form meant, and the script had no idea. The mechanical part is easy. The structural part is the whole problem.

Emacs. The obvious next step was Emacs’s own indentation engine, in batch, over the whole tree. I had a file called batch-indent.el:

( defun  indent-file ( &optional save)
   "Format the whole buffer."
  (indent-region (point-min) (point-max) nil)
  (untabify (point-min) (point-max))
  (delete-trailing-whitespace)
  ( when save
    (save-buffer)))
copy

For a while this felt like a formatter. Lisp indentation is structural, and Emacs’s modes already encode decades of convention. I kept that.

What didn’t work: it needs Emacs; the answer depends on scheme-mode, Geiser, a project’s indent-rules and the Emacs version; it only indents, so it doesn’t own the printer; it isn’t a fixed point; and it has no lint, no exit status and no report. One machine could format a file one way and another machine another way, and both were “right” according to their setup. That’s not a tool. That’s a local opinion with a batch mode.

guix style. The next try was a canonical tool where one existed. guix style knows how a Guix package definition should look, and it has taste. It also formats Guix package definitions, not Scheme. It doesn’t know your modules, your SXML, your general procedures or your comments. It reflows, so every new idea about line breaks turns every file into a diff. And the .el files still went to Emacs, so the repo had two formatters and a boundary where they disagreed. I kept the ambition of a canonical style and the suspicion that reflowing was the enemy.

The compiler. The third try was to stop writing a linter and use the ones the language already had: checkdoc and the byte-compiler for Emacs Lisp, guild compile -W3 for Scheme, guix lint in Guix buffers, plus a small checker that read every .el form and compared the module list in init.el with the files on disk:

( while ( progn (forward-comment (point-max)) (not (eobp)))
  (read (current-buffer)))
copy

This taught me the most important lesson of the bunch: the language’s own reader and compiler know more than any regex. A file that doesn’t read is a finding. A docstring that doesn’t name its arguments is a convention the byte-compiler cares about. lexical-binding isn’t taste; it’s a header the file needs.

But read throws away the evidence. It discards comments, keeps no positions, and can’t represent a block comment, a datum comment or a reader prefix as a node.

The pretty-printer. Once the tree worked, I thought the next step was a pretty-printer. I wrote one that decided line breaks from the structure, the way Prettier does. The output was beautiful. Then I ran it on a 300-line file and the diff touched every line. git blame turned into a joke, and every future change would be buried under the formatter’s opinions. I reverted the file and never wrote that pretty-printer again. That’s where the no-reflow rule comes from.

read plus a scanner. Before I wrote the reader, I tried to build the linter on Guile’s read plus a line scanner. read gave me forms; the scanner gave me lines; I kept a table to map one to the other. Comments fell through the table. A comment inside a form, a #; datum comment, a string with a semicolon in it: the two representations disagreed and I couldn’t tell which one was right. I gave up and wrote the reader. One representation has to win, and it has to carry positions.

Editor macros. I wrote indent-rules and syntax-propertize functions for my own macros in Emacs. It made my editor nicer. It also made CI disagree with my editor even more, because the editor knew my macros and no other tool did. Conventions have to live in a program, not in one editor’s mode.

The pre-commit hook. I wired guix style and emacs --batch into a pre-commit hook. It was fast and useful, and it caught tabs and trailing whitespace before they landed. But it only caught what the tools caught, it couldn’t fix anything, and every repository had its own copy. The pipeline shape was right. The tool behind it was missing.

One tool per dialect. The obvious next move was one tool per dialect: Racket’s own formatter for Racket, guix style for Scheme, Emacs for Elisp, something else for Common Lisp. It worked, in the sense that each dialect got a tool. It also gave me four tools, four configs, four CI steps and four styles that disagreed at the boundaries.

The idea  #

The design is six beliefs, written down in doc/design.org:

  1. A source file is a parsed, not read as a string. A comment keeps its column, a fix replaces one range, a diff’s hunks are the change.
  2. Formatting is idempotent, a fixed point, and the property is tested. The suite formats every fixture, then formats the result again, and asserts that the second pass changed nothing.
  3. You own the program; the tool owns the layout. sift re-indents, re-spaces, re-levels comments and re-brackets a cond clause. It doesn’t rename, reorder or inline a procedure on its own, and it doesn’t introduce a delimiter.
  4. A dialect is a language, not a variant. Common Lisp is not Scheme with longer names. A formatter that infers the dialect will, one day, rewrite Common Lisp as Scheme.
  5. Answer only where the answer can be justified. The language server answers its table and says “method not found” to the rest. A refusal is a feature when the only alternative is a plausible lie.
  6. Everything the program says is available as data. A finding is the same finding in five output formats and over LSP. A rule is a record before it’s a document.

Why the name? To sift is to pass something through a sieve and separate what matters from what doesn’t. A source file mixes the program with the layout. sift separates them, checks the program, and puts the layout back the way the style says. It’s a sieve, not a sculptor.

The performance turn is the unsexy part that made it usable and the initial implementation was indeed naive. Three questions dominated the cost of a lint, and each was originally answered by walking something a second time: whether a node is code or data, what a form is called, and where the lines begin. Each is now computed once and carried or kept.

Together they took a lint of the repository from twenty-five seconds to under one, and the allocation from a gigabyte and a half to a hundred and forty megabytes. Guile’s garbage collector stops every thread, so less allocation means better parallelism too. Now we are highly performant and ready for battle.

What sift actually is  #

One executable, four dialects  #

sift format [OPTIONS] [FILE...]      #  print the formatted file
sift lint [OPTIONS] [FILE...]        #  report findings
sift check [OPTIONS] [FILE...]       #  print the patch, exit 1 if any
sift fix [OPTIONS] [FILE...]         #  lint --fix
sift ci [OPTIONS] [FILE-OR-DIR...]   #  format check + lint, never writes
sift lsp                             #  a language server on stdin/stdout
sift doctor                          #  what ran, what it read, what it decided
sift list-checkers [--dialect D]     #  the catalogue as a table
sift explain RULE                    #  one rule's reasoning
sift config show|explain|trust ...   #  the settings, and which layer won
sift install-hooks [--force]         #  a pre-commit hook that runs `ci'
copy

Status 0 is clean, 1 is findings, 2 is a usage error or a file that can’t be read.

The dialect is explicit ( --dialect), then the extension, then the shebang, then a marker in the first 200 lines: #lang is Racket, defpackage is Common Lisp, define-module is Scheme, lexical-binding is Emacs Lisp. If none answers, it says so. It never guesses. An editor that already resolved the language is better informed, so the LSP takes the identifier the client sends.

A first session is small:

$ cat square.scm
(define (square x)
(* x x))

$ sift check square.scm
--- square.scm
+++ square.scm
@@ -1,2 +1,2 @@
 (define (square x)
 -(* x x))
+  (* x x))
$ echo $ ?
1
copy

check prints the patch and exits 1. It never modifies your files. To make the change, sift format --write square.scm. The next sift check exits 0.

When the environment and the tool disagree, ask the tool:

$ sift doctor
sift 1.41.2
  guile       3.0.11
  library     /home/joe/Hacking/sift/src
  rules       95
  dialects    scheme, racket, elisp, cl

Compilers
  scheme available
  elisp available
  cl not found

Configuration
  project  /home/joe/project/sift.yaml

Settings that are not the default
  brackets: square    #  /home/joe/project/sift.yaml
  severity: warning    #  /home/joe/project/sift.yaml
copy

The reader and the formatter  #

The reader’s job is to keep what it read. Every node carries its source location. Comments, blank lines, datum comments and reader prefixes are nodes, not trivia. That’s what lets the formatter preserve them, and what lets a diagnostic point at the exact line and column.

A file with one broken form still gets a tree, because a linter that reports nothing about a file it couldn’t parse fails exactly when it’s needed. A buffer being typed is a buffer with a broken tail, and the language server still reports everything before the break.

The reader knows each dialect’s read syntax rather than a compromise: #\a is a character in Scheme, Racket and Common Lisp; ?a in Emacs Lisp; #:key is an uninterned symbol, :key a keyword; #| ... |# nests; #; comments out the next datum; #lang opens a Racket module; #{ ... }# is a Guile symbol. A square bracket is a vector in Emacs Lisp and a clause delimiter in Scheme. sift doesn’t average the two.

The formatter performs six operations and no others: normalise line endings, normalise spacing, place closing delimiters, compute indentation, optionally align inline comments, and preserve blank lines up to the style’s limits. Everything else is reproduced as written: line breaks, strings, escapes, comments. The function is deterministic and idempotent, and the suite formats every fixture twice.

There are two styles. community trails the closing delimiters:

( define ( classify n)
  ( cond [(< n 0) 'negative]
        [(= n 0) 'zero]
        [else 'positive]))
copy

dangling puts each closer on its own line for projects that write that way.

Indentation is three rules. A form whose first element is a symbol is looked up in the dialect’s table; a data list or vector aligns under its first element; anything else lines its arguments up under the first argument. With only the operator on its line, the rest goes one column in from the opener. That’s the whole algorithm. The tables exist for the forms where structure alone isn’t enough.

Scheme writes cond clauses with square brackets, as Guile and Guix do:

( cond [(< n 0) 'negative]
      [(= n 0) 'zero]
      [else 'positive])
copy

It’s a setting: --brackets=parens writes parentheses, --brackets=preserve leaves them as written, and Emacs Lisp and Common Lisp keep what they were given. The clause-brackets rule ( SIFT036) reports a file that hasn’t been formatted yet, and its fix swaps the two characters.

The formatter refuses to reflow a long line (the line-length rule warns instead), invent a missing parenthesis, rewrite an expression, or format inside a #; datum comment, a #. form or a #<...> object. sift fix doesn’t reformat, because a fix that moved whitespace would touch every line of the patch it was meant to make readable.

The linter  #

A rule is a record: name, code, description, dialects, default severity, procedure and example. The driver reads the file once, runs the rules the dialect applies to, folds in what the reader reported, honours suppression comments, and sorts the findings by file, line, column and rule. There are 95 rules, each with a stable code ( SIFT001 through SIFT095), assigned by hand and never reused. sift explain RULE reads the reasoning out of the program, and doc/rules.org is generated from the records.

The catalogue, condensed:

Where What it checks
all four whitespace, line length, delimiters, empty bodies, progn, blank lines, comment levels, single-letter names, the if / when / unless family, keyword arguments, complexity
Scheme and Racket internal defines, letrec, quasiquote, clause brackets, docstrings, eta and beta reduction, let simplification
Emacs Lisp docstrings, lexical-binding, interactive, provide, declare, require-cl, save-excursion-set-buffer
Common Lisp package prefixes, double colons, dangling parentheses, LOOP style, identity, ecase-otherwise, mixed-lambda-list
Guix gexps, #$output, with-imported-modules, phase names, sha256, package synopses, inputs
SXML attribute lists, children, empty elements

The catalogue is data:

$ sift list-checkers --dialect=elisp
NAME                  CODE      DIALECTS          SEVERITY   DESCRIPTION
beta-reduction        SIFT046   scheme,elisp,cl   info       A lambda applied  in place, where a  `let` would say it once
docstring-arguments   SIFT034   elisp             info       A docstring that does not mention one of its arguments
...
copy

One rule, read on its own:

$ sift explain if-without-else
CODE
SIFT012
NAME
if-without-else
DESCRIPTION
 `if` with no else branch, where  `when` expresses the intent
DIALECTS
scheme
SEVERITY
warning
FAILING EXAMPLE
( if (ready?) (go))
EXPECTED FIX
(when (ready?) (go))
copy

A diagnostic and a documentation page are the same record. I love that.

A rule may carry a fix: one range. sift lint --fix applies fixes from the highest offset down, then lints once to show what’s left. There’s no loop. After applying them all, sift reads the result again; if a fix introduced a parse error the file didn’t have, every fix of that run is discarded and the original findings are reported. A file the reader couldn’t finish is refused, because a fix around a missing parenthesis would be a guess. --force is how a caller who knows better says otherwise.

Some rules deliberately have no fix. unmatched-parens won’t guess where a ) belongs. wrap-in-let won’t invent a binding name. The naming rules won’t rename anything. blank-line-in-body won’t delete a line. Deciding how to split or name code is your work.

Suppression is a comment, not a config list:

 ;;  sift:disable-next-line keyword-arguments
(make-window a b c d e f g)

 ;;  sift:disable wrap-in-let
( define ( f x)
  ...)
 ;;  sift:enable wrap-in-let
copy

disable-next-line covers the next line, disable covers to the end of the top-level form, and enable ends it. An exception list in a config file is a list no review reaches. This one is in the diff.

Fixing isn’t filtered by severity. severity: warning says what fails a build, not what’s worth repairing on request.

The command line and configuration  #

format prints, --write writes, check answers with a patch and a status, lint reports, lint --fix fixes, and ci asks both questions without touching the tree. A job that edits the tree it’s judging is a job whose verdict means nothing. ci never writes and never fixes.

The same findings come out as the compile-style line file:line:column: severity: [rule] sentence, JSON, SARIF, GitHub annotations, or null.

--watch re-runs when a file the run read changes. It watches what the run read, not what it was given, so a file created three directories down is noticed. A project run distributes files over the processors and prints in file order. SIFT_JOBS is the only setting.

Settings are sift.yaml, or a sift.scm the project has trusted. They’re layered: defaults, system, user, project, command line. Discovery stops at the repository root. YAML is data and can’t execute anything; Scheme is code and must be trusted explicitly, with --config, SIFT_TRUST_CONFIG=1, or sift config trust sift.scm. An unknown key is refused with a position, and sift config show --verbose names the layer that won.

line-length: 90
brackets: square
severity: warning
checkers: [trailing-whitespace, docstring-missing]
stdlib: true
copy

The language server reads the same files, so sift.yaml is the single place where editor behaviour is written down: inlay hints, hover, completion, stdlib, downloads, compiler diagnostics, import organization.

The language server  #

sift lsp speaks LSP over standard input and output. The findings, fixes and formatting are computed once and delivered as text or as LSP responses, so the editor and the pipeline get the same answer.

It answers diagnostics, quickfixes, fix-all, format-this-definition, extract-to- let, extract-to-procedure, extract-a-lambda, inline-a-call, optimize and sort imports, formatting, hover, definition, references, highlights, document and workspace symbols, completion, inlay hints, rename, signature help, and file rename that keeps a Scheme module or an Emacs Lisp provide in step.

It refuses declaration, type definition, implementation, call and type hierarchy, semantic tokens, code lenses, folding ranges, range formatting, format-on-type, pull diagnostics and workspace folder changes. sift models no types, expands no macro, and has no opinion about what to fold. “Method not found” is more useful than a plausible lie.

The project is read in a thread from initialize on. A jump sees the last published snapshot: two thousand files arrive in batches of sixty-four, so the first answer comes after the first batch, and each later batch replaces the snapshot whole. A jump has 100 ms, a reference search 200 ms, and sift/indexStatus says how far the reading has got.

The standard library is indexed from source (Guile’s modules, Emacs’s load-path and package trees, ASDF and SBCL sources, Racket’s collects and pkgs) and from what each implementation says about itself. car is compiled into libguile and no file says where, so the implementation is asked once to write down every name it documents, as source. A jump to car lands in code that reads like the file it’s in. A source archive named in stdlib can be downloaded when the project allows it.

Watching a jump land in Guile’s own source, or in a file an implementation wrote about itself, still feels a little illegal. That’s the LSP work I’m proudest of.

The server can ask the dialect’s compiler for a second opinion on open or save: guild, emacs, sbcl, whichever is installed. A missing compiler is simply not asked, and compiler-diagnostics: false turns it off.

The REPL and the linter  #

This is the setup that made me fall in love with editing Scheme.

My Emacs configuration ( heks-emacs) puts a Geiser REPL (the interactive prompt that evaluates expressions and shows their values) in the middle of Scheme development. C-c g r starts or switches to the project’s REPL: a guix repl in a package buffer, a plain guile one elsewhere, one per project, with the project root on the load path. C-c g e evaluates the definition at point, C-c g E the region or buffer, C-c g b loads the file, C-c g k interrupts, C-c g x runs the file as a script, C-c g s points the REPL at the module, and C-c g d opens the debugger. Completion and autodoc are Geiser’s.

The two files that arrange it are modules/sift.el and modules/guile.el. The keys below are my config’s, not the package’s defaults: the package uses C-c s, which is the snippets topic here, so sift gets the letters the scheme already promises.

sift runs in the same buffer, at the same time, without asking the REPL for anything:

  • sift-flymake runs sift lint --stdin --format=json on the buffer’s own text, saved or not, and turns findings into Flymake diagnostics with the rule’s code and name. Nothing is written.
  • The drift backend marks lines sift format would rewrite. That’s what sift check, and a pipeline running sift ci, fails over. The formatter runs on a copy; the buffer is untouched.
  • C-c g H explains the rule at point. C-c g a applies its fix. C-c g A applies every fix. C-c g f formats the buffer. C-c i f is the historical format key. M-x sift-lint runs the linter in a compilation buffer.
  • Formatting and fixing use sift format --stdin and sift lint --fix --stdin, so neither saves the file and both are one undo away.

Why is this so nice? Because the REPL and the linter answer different questions.

The REPL answers: what does this program do when I run it? It has the loaded state, the values, the stack, the debugger, the generic methods. It knows the definition you just evaluated.

sift answers: what does this file say, and what would a pipeline say about it? It sees the source, the project, the standard library and the rules. It can tell you that a cond clause after else can never run, that an import is unused, that a docstring doesn’t name its arguments, that a line isn’t formatted the way sift ci will require.

A REPL can’t tell you your file is unformatted, and a formatter can’t tell you what an expression returned. My config makes them cooperate:

  • sift is asked first, because it needs nothing but itself. guild compile and guix lint are the second opinion on save. Geiser is the third, for what only a running image knows.
  • Navigation asks sift’s LSP first and falls back to Geiser where it has nothing. sift knows the files and the standard library; Geiser knows what the REPL loaded. M-. is one key over both.
  • When Eglot manages the buffer, sift’s Flymake backend stands aside because the server publishes the same findings. Format-on-save stands down too, so two formatters don’t write one buffer on one save.
  • Formatting doesn’t change semantics, so it’s safe to re-evaluate. The formatter never renames a binding or rewrites an expression.

The loop I do a hundred times a day:

  1. C-c g r starts the project’s REPL.
  2. I write a one-armed if. sift reports SIFT012 / if-without-else on the line, while the buffer is dirty.
  3. C-c g H opens the rule and shows (when (ready?) (go)).
  4. C-c g a applies the fix. One undo, no save.
  5. C-c g e evaluates the definition in the REPL, and I see the result.
  6. I notice a cond written with parentheses. C-c g a swaps in brackets. C-c g f formats. C-c g b reloads, and the REPL has the new definition.
  7. Before I commit, M-x sift-ci runs the whole-project check. Same program, same answer.

None of that needs a save or a build. The REPL keeps the live state, sift keeps the file honest, and I get both answers in the same buffer. It’s the nicest editing loop I’ve had.

Editors, CI and the browser  #

The clients are thin wrappers over the program:

Editor What to use
Emacs emacs/sift.el: Flymake and Eglot
Neovim editors/vim/neovim.lua: a vim.lsp.start setup
Vim editors/vim/: :SiftLint, :SiftFormat, :SiftFix, :SiftExplain
VS Code editors/vscode/: no build step, no dependencies
Helix format on save through sift format --stdin
the browser web/: sift compiled to WebAssembly

In a pipeline, one command asks both questions:

sift ci src/ tests/
copy

It exits 1 if either check finds something, 2 if a file can’t be read or parsed. It never writes.

There’s a reusable GitHub workflow:

name: sift
on: [push, pull_request]
jobs:
  sift:
    uses: jjba23/sift/.github/workflows/sift.yml@v1.40.5
copy

It annotates the diff and uploads SARIF to code scanning, so an unfixed finding becomes an alert instead of a line in a log. There’s also a composite action, a pre-commit hook, a pre-commit declaration, a dprint process plugin, and a Docker image.

The browser build is the part that sounds like a stunt. It isn’t. web/ is formatting and linting compiled to WebAssembly with Guile Hoot, with an editor page around it. The same reader, formatter and 95 rules are in the tab; the two rules that need a project report nothing. No input leaves the tab.

The whole contract is one procedure of one string to one string:

(web-request  "{\"op\":\"lint\",\"source\":\"(if a b)\"}")
 ;;  => "{\"ok\":true,\"result\":{\"warnings\":[…],\"counts\":{…}}}"
copy

The module is 3.4 MB. A screenful formats in 17 ms and lints in 56 ms; 1.2 kB is 52 ms and 145 ms; 6 kB is 780 ms and 1.2 s. The first two rows never reach the 300 ms debounce. Past two kilobytes it’s perceptible, and a checkers list lets a page ask for less work.

The part I love isn’t the number. It’s that the source of truth stayed put. The tab runs the same modules bin/sift runs. Four Guile libraries have stand-ins in web/compat, and SRFI-13 is thirteen procedures with a test that compares the browser’s answers to Guile’s byte for byte. Eight tests hold the dependency one way, so the core doesn’t know a tab exists.

The page is live at https://jointhefreeworld.org/sift/: an editor with the dialect, style and severity as controls, findings linked to the source, an outline, completion, inlay hints and a rules browser. It’s a formatter, a linter and 95 rules in a tab, running the same Scheme as your terminal. I still think that’s wild.

The sift editor in a browser tab
The browser build at jointhefreeworld.org/sift. The same reader, formatter and rules, compiled with Guile Hoot.

What a run costs  #

The suite has teeth, and the benchmark has numbers. On my machine:

lint the tree (28 files, 14896 lines)       337ms, 160.7 MiB allocated
check the tree (28 files): format           253ms,  59.0 MiB allocated
lint (lsp.scm, every checker)               171ms,  19.2 MiB allocated
read the tree (28 files)                    143ms,  44.7 MiB allocated

Both numbers matter. A pass that conses per node makes every other pass slower, and the allocation count shows it even when the clock looks good.

The Veritas suite I ran while writing this: 119 suites, 1,160 tests, 2,624 assertions, about a minute. The reader is tested dialect by dialect; the formatter on a golden corpus plus an idempotence pass; each rule with a passing case, a failing case at a known line and column, a case per dialect, and a re-lint after its fix; the CLI as a subprocess; the language server over the wire. The browser build runs in Hoot’s virtual machine. The project formats itself, so maak self-check is a real gate.

The rules and the opinions  #

The style  #

The style is the common practice of the four communities, written down in doc/style.org. The sources are Riastradh’s Lisp Style Rules, Google’s Common Lisp style guide, the Emacs Lisp manual’s docstring tips, R7RS, and the conventions of Guile and Guix.

The ten choices, in one line each:

  1. Two columns for every body. It’s the smallest visible step, and it’s what every Lisp of the last thirty years does.
  2. Arguments align under the first. A data list or vector does the same.
  3. One blank line between top-level forms. sift never inserts one where there was none.
  4. Closing delimiters trail. dangling is there for projects that decided otherwise.
  5. Square brackets for Scheme clauses. A cond clause is a test and a body; the bracket marks the boundary. It’s a setting, not a law.
  6. Keywords line up. They become a column instead of a ragged tail.
  7. Macro indentation is the project’s rule. No formatter knows what your macro means.
  8. No reflowing. A line break records where you judged the form to end.
  9. Reader prefixes glue to their datum. A newline between ' and its datum is a different program.
  10. Comments stay on their line. A comment’s position is part of its meaning.

sift declines some Riastradh rules: a 72 or 80 column limit (the default is 96, or 80 for Emacs Lisp), pages and form feeds (they rewrite every line number below the break), 21-line top-level forms (that’s your judgement), and with- versus call-with- prefixes (that needs to know whether an argument is called).

What it refuses  #

The opinions show up in what sift won’t do:

  • You own the program; the tool owns the layout. It doesn’t rename, reorder or inline a procedure on its own, and it doesn’t introduce a delimiter.
  • A dialect is a language. Never guess.
  • A fix that can’t be verified is discarded. Not guessed at, not applied with a warning.
  • Lint reports, fix is opt-in, and CI never writes.
  • Suppression belongs next to the code.
  • Codes never move. A name is the token you type; a code is what an editor and a bug report quote.
  • Rules are data first. The catalogue, diagnostics, code actions and browser list are renderings of the same records.
  • Configuration is data; code is a decision. YAML can’t execute anything. Scheme can, and must be trusted.
  • Few knobs. A formatter with a hundred options has no opinion.
  • Refuse what you can’t answer. “Method not found” beats a plausible lie.
  • No second implementation. The browser is a compile of the same modules; the editors are thin wrappers.
  • MIT. A formatter in other people’s pipelines can’t carry a licensing question.

sift doesn’t expand macros, type-check or know your conventions. It reports; you decide. Where it can be wrong, the rule says so: wrap-in-let is a suggestion, keyword-arguments counts, thresholds are settings. The LSP has two limits: references are matched by name within one dialect, and the project is read in the background, so a jump answers from what’s been read. Range formatting, format-on-type, fold ranges, macro-introduced names, pull diagnostics and a --since REV mode are in scope and not built yet. A limit that’s written down is a limit a contributor can remove.

Where sift fits  #

Compared to the neighbours  #

Project What it is Where sift differs
cljfmt A Clojure formatter Clojure only, and it reformats from a parsed form; sift asserts its fixed point over a corpus and lints too
clj-kondo A Clojure linter with a checkable macro config and an LSP Lints only, no formatter; its analysis is Clojure’s
rustfmt, gofmt Canonical formatters for Rust and Go One language, one style, no linting; their authority is canonical, sift writes the style down
clang-format A configurable C-family formatter Configuration is its product; sift has few settings and refuses to reflow
Prettier An opinionated multi-language formatter Closest philosophy, but it reflows and doesn’t preserve every comment and blank line
Emacs’s toolchain indent.el, checkdoc, the byte-compiler, Flymake No CLI, CI shape, JSON, SARIF or LSP
scheme-mode and guild compile -W3 Editor indentation and compiler warnings Nothing between them, and nothing a pipeline can read as one report
SLIME, SLY Common Lisp environments Indentation specs and xref, but an environment, not a program; answers need a running image

The neighbours do three things I want to steal: a checkable macro configuration (clj-kondo), answers from real analysis (SLIME, SLY), and the authority of a canonical tool (rustfmt, gofmt). None carries a browser build of the same code, and none treats four dialects in one executable as the premise.

The gap  #

Lisp has plenty of tools. The problem is where they stop.

  • Scheme has scheme-mode, guild compile -W3 and guix style. None is a general formatter, a project linter or an LSP; guix style is deliberately about Guix, not Scheme.
  • Emacs Lisp has checkdoc, the byte-compiler and Flymake. They know the conventions, but a compiler warning is prose: no stable code, JSON, SARIF, CLI, LSP or fix.
  • Common Lisp has SLIME and SLY. They’re an environment, not a program a pipeline runs.
  • Racket has its own tools, but they’re Racket’s, and a repo with Scheme and Emacs Lisp still needs the others.
  • Clojure is the exception: cljfmt and clj-kondo are excellent, and Clojure-only.

sift fills that with one executable, one config and one CI step for four dialects. It also fills the gap inside Guix and Guile: guix style knows package forms; sift knows general Scheme, and it has rules for assoc-ref %outputs, a #$output that makes a file, a use-modules inside a gexp that with-imported-modules doesn’t mark, an unquoted phase name, a sha256 that isn’t (base32 "..."), a synopsis that opens with an article, and inputs written as a labelled alist. Those are the habits of a community, written down as rules with codes and fixes.

Why is it actually useful? It runs where the code runs: CLI, hook, GitHub Action, container, editor, browser tab. It gives the same answer everywhere. It’s adoptable: ci never writes, fix is opt-in, severity is a project decision, suppression is local. It’s fast enough for save (337 ms to lint 28 files, 171 ms for one file with every checker). It’s small: Guile and the standard library, no C, no build step. And it’s MIT.

The best proof is that the project uses itself: maak self-check, maak fixture-check and sift ci are the gates.

Under the hood  #

src/sift/ is one module per job. The important ones:

records.scm       locations, findings, rule records, codes, AST nodes
reader.scm        the permissive, location-preserving reader
format.scm        the pipeline, indentation tables, renderer
check/base.scm    walking a tree, reading a form, line arithmetic
checkers/         one module per family of rules
lint.scm          run, suppress, filter, sort, fix, re-lint
render.scm        human, JSON, GitHub, null, SARIF
config.scm        discovery, merging, provenance, trust
analysis.scm      the LSP questions that are a function of a buffer
lsp.scm           diagnostics, actions, formatting, hover, navigation
cli.scm           args-fold, dispatch, exit codes

records is the vocabulary; reader and format use it; the checkers use records and check/base; lint assembles them; render prints; lsp speaks the protocol; cli wires it up. Nothing in format or a checker knows about ports or exit codes.

The implementation is Guile 3.0 and the standard library. No C dependency, no build step. The launcher is a small POSIX shell script that finds its own symlink chain, puts src/ on the load path, and hands the arguments to (sift cli). The whole program reduces to a use-modules and a sift-main call if you don’t want the launcher.

Install with guix install sift from the guix-jointhefreeworld channel, nix run from the Nix flake, Homebrew from the tap, a container image, or a checkout and ./bin/sift version. The Emacs package is one file with no dependencies beyond Emacs 28.1.

Come help  #

The list of Lisp dialects that deserve a better reader is long, and each item is a contribution that can be carried to the end.

  • A bug report. Give the input, the output you expected, and sift version with the first section of sift doctor. A file sift refuses to parse is a bug even when the file is broken; the message must say where.
  • A rule. One record and one test file. The catalogue, docs and editor integrations follow. The contributing guide has the five steps.
  • A dialect detail. An escape, a comment in an odd place, a body that indents by something other than two. tests/reader-*.scm and tests/format-*.scm hold the behaviour.
  • An editor integration. Neovim, Vim and VS Code each have a directory and a test in that editor’s tool. A fourth editor is one directory more.
  • A sentence in the docs. The README, the style page and the rule descriptions are read by people deciding whether to trust the tool. A sentence that causes hesitation is a defect.
  • A bigger piece. The roadmap below has the ones I want most; pick one and open an issue.

A first patch: read doc/style.org, run maak test before changing anything, add the rule or fix with its test under tests/checkers/, then run maak self-check, maak check and maak fixture-check. Send a pull request, or a patch with git format-patch and git send-email. maak test-suite runs the one suite whose file is open in a second.

The AI policy is short: agents may explore, plan, branch, run the build and tests, commit, push, open and merge pull requests, and cut releases. A human is the author of record and must be able to explain and debug every line. TDD is required: failing test, watch it fail, least code, refactor, full suite. Disclose the tool and what it did. A bug report or rule written with an agent is as welcome as one without; the review concerns the code.

Questions are as welcome as issues. If the README doesn’t answer it, that’s a bug in the README.

Where we are going from here  #

sift is useful now, but it isn’t finished. The long version is in VISION.md; here’s the short one, roughly in the order I think it can land.

  • Range formatting and format-on-type. The formatter indents from column zero, so a fragment lands at the margin. The hard part is an origin column that still produces, for the range it touched, the bytes a whole-buffer run would. It’s the missing piece for editor parity.
  • A --since REV mode. Lint the lines a diff touched, not the whole tree. That’s what lets a large codebase adopt a linter without a mass reformat, and it’s the feature I want most for CI.
  • Resolution across files. Follow define-module, #:use-module, defpackage and provide far enough that a reference is a binding, not a name. Then a project-wide rename is correct in every file, and a jump lands on the definition rather than a same-named symbol. Project-scale operations stay reviewable too: a rename, a fix-all or a formatting sweep should produce one patch whose hunks are the change.
  • A declared-macro table. A project declares what its macros bind, so references and rename can see the names a macro introduces. It’s the largest correctness win left, and it needs an argument before a patch.
  • The style as a specification. The rules and the corpus are already there. The next step is a document a second implementation can be checked against. If the style is the artefact, the implementation can be replaced, and the conventions outlive it.
  • A fifth dialect. Racket was the fourth and cost a table, a dozen rules re-argued and a corpus of its own. Each one after that is more evidence that the reader, formatter and rule records are the general part and the dialect is the detail.

Smaller things on the list: pull diagnostics, fold ranges, and a sift new-rule command that writes the record and the test. None of this is a promise with a date. It’s the direction. If one of them sounds like your afternoon, open an issue and I’ll help you too

If you have a Lisp dialect that deserves a better reader, a rule your project keeps repeating in review, an editor that should have the server, or a sentence that would have saved you five minutes, that’s a contribution. The seeds are already there. Come and plant one.

Thursday, December 3, 2026

Monday, November 30, 2026

Scheme Requests for Implementation

SRFI 282: Additional R7RS (Type) Predicates

SRFI 282 is now in final status.

Types and entities deserve predicates so that their user can meaningfully understand what they are dealing with, and usefully dispatch on them in their code. However, some R7RS “types” have no respective predicates. This SRFI defines them.

by Artyom Bologov at Monday, November 30, 2026

Saturday, November 28, 2026

crumbles.blog

Note about my fediverse account

Update, 29 November: The suspension has now been reversed and I received an apology from the mastodon.social moderation team. They acknowledged having made a mistake, and say there is a discussion internally on how to prevent the mistake recurring.


My fediverse account, @dpk@swhack.com, has been suspended on the largest Mastodon instance, mastodon.social, for unclear reasons since roughly Tuesday 24 November.

This apparently means that if you have your account on mastodon.social and I was following you, I can no longer see your posts, but if you were following me, you may still be following me but I doubt you will see any of my posts there.

At the beginning of September I moved from chaos.social to my own Mastodon instance, meaning I should be able to see moderation reports made against my own account. I did not receive any report about my account before the suspension was made, and I only noticed because posts from people I also follow via Bridgy on Bluesky only showed up on the Bluesky side and not in my own fediverse timeline.

Attempts to reach the moderation team of mastodon.social have thus far not yielded a reply. I’m going to continue to follow this up and hopefully get it resolved soon.

Saturday, November 28, 2026

Friday, November 27, 2026

Joe Marshall

Updates to named-let

Updating named-let: ignored bindings, multi-form inits, and more

named-let is a small Common Lisp library of Scheme-inspired binding macros: named-let, named-lambda, letrec, letrec*, flambda, and a Lisp-1 style define. It also provides an extended let that you can shadow-import in place of the standard one. This post describes a round of changes to the library: a new way to ignore bindings, clarified handling of multi-form bindings, a bug fix, and improvements to documentation and tests.

Ignored bindings with _

Sometimes you want to bind something only for its side effect. In standard Common Lisp you must invent a variable and declare it ignored:

(let ((a 22)
      (dummy1 (format t "foo"))
      (b (sqrt 2))
      (dummy2 (format t "bar")))
  (declare (ignore dummy1 dummy2))
  body)

Now the extended let does this for you. Any binding of the symbol _ is replaced by a fresh uninterned symbol (a gensym), and a single ignore declaration for all such symbols is added at the start of the body:

(let ((a 22)
      (_ (format t "foo"))
      (b (sqrt 2))
      (_ (format t "bar")))
  body)

;; expands to

(let ((a 22)
      (#:ignore-1 (format t "foo"))
      (b (sqrt 2))
      (#:ignore-2 (format t "bar")))
  (declare (ignore #:ignore-1 #:ignore-2))
  body)

A few details worth knowing:

  • The init forms are still evaluated, and in order, so _ is useful for side effects.
  • You can have any number of _ bindings; each gets its own gensym, so there is no “variable occurs more than once” error.
  • The bare forms _ and (_) are accepted and bind to nil.
  • _ is matched by name, not by identity, so it works no matter which package your code is read in.
  • A declare at the start of your own body coexists with the generated one.
  • Because the generated declaration is placed first, the ignored variable can never be referenced from the body; _ is not a variable you can read.

The same convention applies to a named let, because its bindings become the parameters of a named-lambda, and to named-lambda parameters themselves:

(funcall (named-lambda second-arg (_ x _) x) 1 3 2)
;; => 3

(funcall (named-lambda f (a &optional (_ 9)) (+ a 3)) 1)
;; => 4

Multiple forms in a binding

A binding in the extended let may contain more than one init form. The forms are wrapped in a progn and the last value is bound:

(let ((a (format t "binding a") (+ 2 (sqrt x))))
  (+ a b))

;; expands to

(let ((a (progn (format t "binding a") (+ 2 (sqrt x)))))
  (+ a b))

The library already handled this, so no code change was needed, but it is now pinned down with a test and documented. As in standard Lisp, a bare variable y or a one-element binding (z) is bound to nil, and all bindings are made in parallel: init forms do not see the new variables.

How the expansion works

The extended let looks at its first argument. If it is a list (or nil), it is an ordinary binding list; the macro walks the bindings, replaces each _ with a gensym while collecting the gensyms, and emits the underlying let with the bindings, an optional (declare (ignore ...)), and the body. If the first argument is a symbol, it is the name of a named let and the expansion is a funcall of a named-lambda.

As before, the macros are SERIES-aware. Expansions refer to let and funcall in the SERIES package when it is loaded and the symbol is fbound there, and to COMMON-LISP otherwise. That is why an expansion you inspect in an image with SERIES loaded will begin with series::let. Expansion templates use qualified symbols so they resolve to COMMON-LISP symbols regardless of any shadowing in the consumer's package.

A bug fix in named-lambda

Writing more tests for _ turned up two bugs in named-lambda, which also supports _ parameters:

  1. The binding that extracts an optional docstring had a misplaced parenthesis, which made the let* binding spec malformed and caused a compile error in the macro definition.
  2. It recognised _ by comparing with eq against the symbol named-let::_. A _ read in any other package is a different symbol and so was not recognised, leading to a “variable _ occurs more than once in the lambda list” error. It now compares symbol names, exactly as let does.

Docstrings and comments

Every macro in the library now has a docstring. named-lambda and named-let were missing them, and letrec* had copied letrec's text; it now says its bindings are initialised sequentially so later ones can use earlier ones. I also added short comments in the places where the code is not self-explanatory: the gensym-and-declare logic in let, the difference between letrec (simultaneous assignment) and letrec* (sequential assignment), and the _ handling in named-lambda.

Tests

The FiveAM suite grew from 24 to 44 checks. The new tests cover:

  • _ in let: evaluation order of the init forms, the shape of the expansion (distinct uninterned symbols and a single declare), bare _ and (_), all-_ binding lists, and a user declare alongside the generated one.
  • Multi-form bindings, both the expansion and the resulting value and side effects.
  • Parallel binding semantics and a let with only a declare in its body.
  • named-lambda with repeated _ parameters, _ with a default in &optional, and a docstring.

Run them with (asdf:test-system "named-let-test"). One practical note when writing your own: do not use names locked by the implementation (such as loop or count) as the name of a named let.

Documentation

The README was rewritten with a summary table and examples for every macro, including the previously undocumented flambda. Along the way I corrected a few inaccuracies: the clone URL, and the claim that define defines local functions (it is a top-level form that stores the function in the symbol's value cell and defines a macro that funcalls it).

There is also a short section on choosing a name for a named let. When the name just means “go around again”, a short one such as next or l reads well:

(named-let next ((i 0) (acc '()))
  (if (= i 5)
      (nreverse acc)
      (next (1+ i) (cons (* i i) acc))))
;; => (0 1 4 9 16)

You cannot call it loop: COMMON-LISP already binds that symbol as a macro, and implementations such as SBCL lock the package. The same is true of other standard names like count.

Getting it

The code is on GitHub at jrm-code-project/named-let. Clone it into your Quicklisp local-projects directory and load it with (ql:quickload "named-let").

by Joe Marshall at Friday, November 27, 2026

Saturday, November 21, 2026

Idiomdrottning

MPD as shell event driver

Here is a shell script for having the Music Player Daemon trigger events. It shells out to mpc and this example config also shells out to kasa, a lamp control app. In the example, each album in the playlist has its own mood lightning. You can get fancy and add --transition flags, perhaps starting the transition by %position% of the previous album’s last song and prepending a sleep such-and-such-many seconds; rather than by %album%.The script is meant to run in the background or with dtach or systemd until mpc’s event listener hears from MPD.In the past I’ve used MPD as a soundboard backend when DM-ing and if it can also control lights (more subtly than in this example) I might want to dust that off.#!/bin/sh # Put any pre-loop commands here such as exports and any initial # settings you want before the sound starts playing export KASA_USERNAME="your kasa email" export KASA_PASSWORD="your kasa password" export KASA_HOST="your kasa IP" while true; do pos=$(mpc -f %position% current) album=$(mpc -f %album% current) case "$pos" in 2) kasa brightness 100 ;; esac case "$album" in "Veil of Imagination") kasa hsv 120 100 80 ;; "The Fierce and the Longing") kasa command set_device_info '{"color_temp": 4500, "brightness": 20}' ;; "When I Die, Will I Get Better?") kasa hsv 200 40 85 ;; "Still Life (Remastered)") kasa hsv 0 100 50 ;; esac mpc idle player done For a repo of this example script,git clone https://idiomdrottning.org/kasampd

by Idiomdrottning at Saturday, November 21, 2026

Thursday, November 19, 2026

spritely.institute

Lisp Game Jam devlog: Polydraw

This year's Autumn Lisp Game Jam has just wrapped up! Spritely's contribution to the jam was Polydraw, a peer-to-peer party game that is easy to pick up and play with friends. In Polydraw, players take turns being the artist who draws an image based on a prompt. The catch is that the artist only has 60 seconds and can only draw using triangles. All of the other players are guessers who try to correctly guess the prompt. We're quite pleased with how the game turned out!

The rest of this post is a daily devlog of how we made Polydraw so you can see what the process look likes to make a game with Goblins and Hoot under a tight deadline.

Day 1 (10/30)

It's go time! First, we created a Git repository on Codeberg and copied the Hoot game jam template into it.

Since the core activity in Polydraw is drawing triangles, the first thing Dave implemented was an interface for doing that on a canvas. This first version was crude and didn't include a color picker.

Day 2 and 3 (10/31 and 11/1)

We took the weekend off to prepare for a busy week ahead.

Day 4 (11/02)

This is the day that we really got to work on the game jam.

The first version of the triangle editor stored pixel coordinates of the local canvas, but that wasn't going to be good enough to display on other machines with different sized canvases. So, Dave simply normalized triangle vertices into the [0,1] range so each peer could scale them as needed.

Dave also implemented a basic scene system, a common game programming pattern, to encapsulate the coarse game states such as the title screen, the lobby, and the main game.

A color palette was added along with some additional mockup UI around the canvas.

Day 5 (11/03)

With a good enough game engine in place, we turned our attention to the game protocol. Since we are using Goblins, all interactions are modeled using actors. Dave came up with the following actors:

  • Player: Used for player identity within the game and contains the player's self-proposed name.

  • Lobby: The place where players gather before the game starts. The player that creates the lobby is the host and all other players are guests.

  • Game: Holds all of the game state like the player list, whose turn it is, and the scoreboard.

  • Controller: A player's virtual game controller. Used to speak to the game actor, but all actions are scoped to the individual player.

A test script was written to simulate creating a game, joining the lobby, and playing a round. At this stage, everything was happening in a single process. Goblins makes it easy to start with a single process and then distribute the actors to multiple machines later.

Day 6 (11/04)

Now it was time to get the actors onto the network and hook them up to the game UI. For networking we used OCapN, naturally. Jessica started up an instance of our new end-to-end encrypted relay netlayer that we set as the default relay so the game would "just work" when we uploaded it to itch.io. In fact, dogfooding the relay was a large part of the motivation behind participating in the game jam in the first place!

Dave got the actors online with OCapN and connected the game UI to the actors, then confirmed that a three player game works. Three players is the minimum number of players needed to trigger OCapN's third-party handoff feature. Handoffs are what enable distributed networking in OCapN: Alice can give Bob a reference to Carol, which causes Bob and Carol to establish a new OCapN session with each other. This is the first application we've made that does handoffs over the relay netlayer and it was nice to see them working as intended.

Unfortunately, we discovered an issue with how Goblins handles two peers connecting to each other concurrently, a problem known as "crossed hellos". OCapN mandates that only one connection may be open between any two peers, so we have to pick which connection wins. The bug is that any promises that were created over the losing connection never resolve. This was observed in the game as an empty lobby player list that should be populated. It didn't prevent the rest of the game from working, though, so we didn't try to fix it (yet).

Day 7 (11/05)

On this day, Dave discovered that, despite his best efforts, he fell victim to the "identity footgun". We could write a whole blog post series about the many subtle issues of object identity (in the sense of Scheme's eq?) in object capability systems, but instead we'll refer you to the The Grant Matcher Puzzle and just mention that using object references as keys in associative data structures is error-prone. A promise that eventually resolves to a reference to Alice is not identical (again, in the eq? sense) to a reference to Alice. So, if you accidentally use a promise as a key somewhere or use eq? directly you will probably have a bad time, which is exactly what happened to us.

To deal with this identity crisis, Dave first detected it at runtime by writing a wrapper around eq? called geq?. This new predicate throws an error when comparing a promise to a non-promise. Then he used the resulting backtraces to find the offending code and change it to resolve all necessary promises before doing identity comparisons.

Christine finally cleared enough other things off her plate where she could start contributing to the game. We thought it would be nice to have the game start with a splash screen of triangle'y animations that would resemble the kinds of art players would make in the game. We decided to use the Blender add-on by Ursula Kurdali named Stop Motion since it gives a great amount of freedom to animate by creating and destroying as much geometry as you like. Christine made the first mockup of a splash screen animation of a "death" type character swinging a scythe.

However, the animation hadn't left Blender yet. We're gonna have to figure out how to get those polygons out and into the game engine!

Day 8 (11/06)

This was the day to finish implementing the core game loop. We wanted the weekend to be all about fixing bugs and making it look and feel as good as we can. At last, the points awarded at the end of each round were displayed in the UI. The player list on the left side of the screen was transformed into a leaderboard that sorted players by score.

While creating the leaderboard it was discovered that Goblins was not correctly parsing pairs received over OCapN. Christine swooped in with a quick fix and Jessica folowed up with a regression test.

We also added a small set of emoji reactions underneath the leaderboard. Reactions were not critical to the core gameplay but they were planned from the very beginning of the project. It's good that we had time to add them because it was a lot of fun to spam emojis at the artist to give them an indication of how good or bad they were doing.

Day 9 (11/07)

With two days left and the core gameplay loop complete, the focus shifted to bug fixing and adding juice. Up until this point the HTML was mostly unstyled (as you can see in the videos above), so Dave added a little CSS to improve the look and feel.

A playtest revealed that the simple PRNG we were using was implemented incorrectly. We noticed because the artist prompt was always "bus" no matter how many rounds you played. Oops! This was fixed.

Remember that crossed hellos bug from day 7? Dave finally implemented a workaround, which was to simply throw out the first pancake and try again, as suggested by Christine. A simple race against a timeout was all that was needed. We'll be thinking about how to fix this in Goblins so this situation cannot happen in the future.

Christine started work on making more animations for the game's intro. The "death" animation was a good "hello world" for testing the exporter, but being all black it was too simple to make sure everything worked right; draw order, etc, didn't matter. Christine made a "square guys" animation as a kind of Acid2 test equivalent. This file had several tricky properties to it, most especially that draw order would matter, colors would be important, et cetera.

Christine also made this triangle'y duck themed piece:

Christine wrote a Python script to export the animations from Blender into a custom format encoded using Syrup. The encoded data was then embedded into the Scheme program as bytevector literals using a little script. Dave then started work on a renderer for these animations, but it wasn't working quite well enough by the end of the day to commit and push it.

Up until this point we only had a small number of frequently-repeated words. Morgan Lemmer-Webber curated a word list for us, starting with an existing public domain word list of 5000 words, and curated down to a 621 words, selecting for words that were more feasible to draw (ranging from easy to challenging, but all trying to be feasible).

The game name was changed from the placeholder "Twenty Triangles" to "Polydraw".

Day 10 (11/08)

The final day.

The code to render animations was finished. Some final minor bug fixes were made. Some CSS was tweaked. Original music and sound effects by encrypted.whispers were added. Additionally, we used a few CC0-licensed sound effects by Kenney.

A few gameplay improvements were made, such as showing guessers what the prompt was when the round ends and how many triangles the artist had remaining. Little improvements can make a big difference and both of these changes were very helpful for players and made the game feel more polished.

There wasn't enough time remaining to do as much work on resiliency in the face of network partitions as we would have liked, but Dave did squeeze in a commit that allowed the game to survive if a guest leaves. Unfortunately, the experience for the disconnected guest isn't very good as they don't see any message that their connection dropped.

We did a final playtest to confirm that there weren't any showstopper bugs. Christine added final splash animations.

Finally, Christine added some code (fixed up by Dave) and animations which would overlay over the drawings indicating that drawing was starting, it was time to guess, or the results.

Pencils down!

We submitted the game two hours before the deadline! Now it was time to catch our breath and show off the game to everyone we could. Dave even played it live with a couple other people on a stream! Here's a screenshot which gives you a good look of the final result:

The response was quite positive! The feedback we received closely matched the things we wanted to improve upon if we had more time: better disconnect handling, a way for the host to skip to the next phase instead of being forced to wait for the timer to run out, and invite URLs (rather than URIs) that auto-join the game when visited.

Polydraw ranked 5th overall in the official game jam results.

Try playing it over on itch.io and leave us a comment!

Thanks to our supporters

Your support makes our work possible! If you like what we do, please consider becoming a Spritely supporter today!

Diamond tier

  • Aeva Palecek
  • David Anderson
  • Holmes Wilson
  • Jonathan Frederickson
  • Lassi Kiuru

Gold tier

  • Alex Sassmannshausen
  • Juan Lizarraga Cubillos
  • Nerine Pekowsky
  • Serra Allgood

Silver tier

  • Austin Robinson
  • Brit Butler
  • Charlie McMackin
  • Dan Connolly
  • Deb Nicholson
  • Diana Thayer
  • Eric Bavier
  • Eric Schultz
  • Evangelo Stavro Prodromou
  • Evgeni Ku
  • Glenn Thompson
  • James Luke
  • Jonathan Smith
  • Jonathan Wright
  • Justin Sheehy
  • Matt Panhans
  • Michel Lind
  • Mike Ledoux
  • Nathan TeBlunthuis
  • Nia Bickford
  • Noah Beasley
  • Steve Sprang
  • Travis Smith

Bronze tier

  • Alan Zimmerman
  • Aria Stewart
  • Ben Hamill
  • Benjamin Grimm-Lebsanft
  • Brooke Vibber
  • Brooklyn Zelenka
  • Carl A
  • Crazypedia No
  • Ellie High
  • Elliot Martin
  • François Joulaud
  • Gabor Udvari
  • Grant Gould
  • Gregory Buhtz
  • Ivan Sagalaev
  • James Smith
  • Jason Wodicka
  • Jeff Forcier
  • Marty McGuire
  • Mason DeVries
  • Michael Orbinpost
  • Neil Brudnak
  • Nelson Pavlosky
  • Nicholas Farley
  • Philipp Nassua
  • Rodion Goritskov
  • Ron Welch
  • Stefan Magdalinski
  • Stephen Herrick
  • Steven De Herdt
  • Tamara Schmitz
  • Thomas Talbot
  • William Murphy
  • Yoshua Wakeham
  • a b
  • chee rabbits
  • r g
  • terra tauri

by Dave Thompson, Christine Lemmer-Webber at Thursday, November 19, 2026

Saturday, November 14, 2026

Scheme Requests for Implementation

SRFI 289: Unordered sets and bags

SRFI 289 is now in draft status.

Sets and bags (also known as multisets) are unordered collections that contain only objects of a type given by a collection’s SRFI 128 comparator. Every element of a set is unique (in the sense of the set’s comparator), but bags can contain any number of duplicate elements. This SRFI is a revision of SRFI 113 that fixes several infelicities and is more consistent with related SRFIs.

by Wolfgang Corcoran-Mathe (text and test suite), Peter McGoron (sample implementation), and John Cowan (author of SRFI 113) at Saturday, November 14, 2026

Sunday, November 1, 2026

Scheme Requests for Implementation

SRFI 272: Pretty Printing

SRFI 272 is now in final status.

This SRFI follows the traditional Scheme model of pretty printing, which treats it as a process distinct from general controlled formatting. While general-purpose formatters often prioritize specialized presentation at the expense of machine-readability, Scheme’s pretty-printers (such as those of SLIB and MIT Scheme) have traditionally treated pretty printing as a variant of write, differing primarily in the insertion of whitespace to make the presentation more palatable to humans. Common Lisp’s pretty-printer, by contrast, fills two roles simultaneously by integrating pretty printing with both its format facility and its generalized write procedures. This unified approach offers great power, but at the cost of complexity that can make it difficult to use effectively. We propose a specialized, layered approach, specifying five libraries of increasing functionality, where all but the first are optional. The libraries are downward-compatible: more powerful libraries satisfy all requirements of the simpler ones while adding new features. Implementors may choose to support a maximum level of functionality appropriate for their systems. Integration with monadic and string-based formatting libraries is supported.

by Sergei Egorov at Sunday, November 1, 2026

Thursday, October 29, 2026

Scheme Requests for Implementation

SRFI 279: In(tro)spection Protocol

SRFI 279 is now in final status.

Interactive REPL-driven systems (that most Schemes are) need a way to get detailed information on a given piece of data. Inspectors, as these are conventionally called. This SRFI defines a basic protocol for inspectors, consisting of three procedures: inspect-properties, inspect-property, and inspect-describe. Some suggestions for standard and popular types’ inspection are also provided.

by Artyom Bologov at Thursday, October 29, 2026

Wednesday, October 28, 2026

spritely.institute

Hoot 0.10.0 released!

We are excited to announce the release of Hoot 0.10.0! Hoot is a Scheme to WebAssembly compiler backend for Guile, as well as a general purpose WebAssembly toolchain. In other words, Scheme in the browser!

This release contains new features and bug fixes and since the 0.9.0 release back in May.

Use Hoot in the upcoming Lisp Game Jam!

On Friday (October 30th 2026), the autumn edition of the Lisp Game Jam will begin! It's a 10-day long game jam where participants make games using their favorite flavor of Lisp.

Does making a small web game in Scheme using Hoot sound appealing to you? Well, then we have just the thing to get you started: the Hoot game jam template! This template project has everything you need to start making an HTML5 game with Hoot quickly.

The template repository includes:

  • Bindings to the necessary web APIs to make an interactive game with HTML5 canvas

  • A Makefile for compiling, running a development web server, and generating a .zip bundle for uploading to itch.io

  • A very simple Breakout-like example game that demonstrates how to put all the pieces together

For more inspiration, here are some games made with Hoot for past jams:

Now, onto the release notes!

Compiler changes

  • Added module name to contextualize duplicate import errors.
  • Added support for library versioning for R6RS compatibility.
  • Fixed default version for define-module libraries.
  • Fixed locate-library not respecting configured load extensions. Previously, we were using Guile's load extension parameter instead of Hoot's own.

Runtime changes

  • Added %struct-ref and %struct-set! primitives for accessing record types defined using the interpreter.
  • Stopped raising errors when importing an undefined symbol in the runtime module system. Guile is lax about this so Hoot being strict caused compatibility issues.
  • Fixed optional argument parsing in primitive-eval.
  • Fixed keyword argument parsing for procedures with both optional and keyword arguments in primitive-eval.
  • Fixed error messages regarding runtime module registry to include the correct CLI flag: -fruntime-modules.

Scheme changes

  • Added partial implementation of SRFI-13: String Libraries. It's just a set of re-exports, very similar to Guile, but Guile's SRFI-13 module is not declarative and is thus rejected by Hoot's compiler.
  • Added partial implementation of SRFI-60: Integers as Bits.
  • Added define-macro, defmacro, delete, list->symbol, and symbol to (guile).
  • Exported define-syntax-parameter and syntax-parameterize, symbol-append, integer-length, and gensym from (guile).
  • Added list->bitvector and bitvector to (hoot bitvectors) and re-exported them in (guile).
  • Implemented get-bytevector-all in (rnrs io ports).
  • Made bytevector=? a publicly exported procedure from (hoot bytevectors) and (rnrs bytevectors).
  • Added define-syntax-parameter and syntax-parameterize primitives.
  • Improved (ice-9 exceptions) exports to more closely match Guile.
  • Added (rnrs) module.
  • Added (rnrs base) module.
  • Added (rnrs syntax-case) module.
  • Added (rnrs r5rs) module.
  • Added (rnrs hashtables) module.
  • Added (rnrs files) module.
  • Added (rnrs enums) module.
  • Added (rnrs exceptions) module.
  • Added (rnrs arithmetic fixnums) module.
  • Added (rnrs records inspection) module.
  • Added (rnrs records procedural) module.
  • Added (rnrs records syntactic) module.
  • Added (rnrs io simple) module.
  • Added (rnrs io ports) module.
  • Added port-has-position? to (hoot ports) for R6RS compatibility.
  • Added stubs for centered division to (hoot numbers) and a stub for integer-length to (hoot bitwise) for R6RS compatibility (eventually).
  • Rewrote (rnrs bytevectors) as an R6RS module with version (6).
  • Fixed number->string to round floating point decimal part to an even digit.
  • Fixed number->string for floating point numbers ±2^N, where 52 <= N <= 1023.
  • Fixed incorrect bytevector copy in number->string floating point conversion algorithm.
  • Fixed min/max macros not working when given zero arguments.
  • Fixed the parameters to the log procedure in (guile).
  • Fixed the implementation of negate in guile. It was doing entirely the wrong thing.

CLI changes

  • Port numbers are now validated to be exact integers in the range [1, 65535].
  • Actually complain about invalid option or unknown subcommand. Previously, the code that was supposed to do this was unreachable.
  • Add --experimental-wasm-exnref feature flag when running hoot compile --run=node for continued compatibility with supported NodeJS versions that don't have the new Wasm exnref feature enabled by default.
  • Fixed build-time disabling of hoot server. In past releases, the hoot CLI script would still attempt to load should-be-optional libraries that ./configure had already determined to be missing. Thanks to mcc for discovering this blunder.

Documentation changes

  • Improved instructions in "Building from source" section of the manual.
  • Dependencies are now mentioned in the "Advanced path" section of the README.
  • Updated project template README to say Guix is not required (though it's still the easiest option).

Browser compatibility

  • Compatible with Safari 26 or later.
  • Compatible with Firefox 121 or later.
  • Compatible with Chrome 119 or later.

Get Hoot

Hoot is available in GNU Guix:

$ guix pull
$ guix install guile guile-hoot

Also, Hoot is now available in Debian, though it will take awhile for this release to make it there.

Otherwise, Hoot can be built from source via our release tarball. See the Hoot homepage for a download link and GPG signature.

Documentation for Hoot 0.10.0, including build instructions, can be found here.

Get in touch

For bug reports, pull requests, or just to follow along with development, check out the Hoot project on Codeberg.

If you build something cool with Hoot, let us know on our community forum!

Thanks to Z572, stdh, Walter Lewis, and Jelle Licht for their contributions to this release.

Until next time, happy hooting! 🦉

Thanks to our supporters

Your support makes our work possible! If you like what we do, please consider becoming a Spritely supporter today!

Diamond tier

  • Aeva Palecek
  • David Anderson
  • Holmes Wilson
  • Jonathan Frederickson
  • Lassi Kiuru

Gold tier

  • Alex Sassmannshausen
  • Juan Lizarraga Cubillos
  • Nerine Pekowsky
  • Serra Allgood

Silver tier

  • Austin Robinson
  • Brit Butler
  • Charlie McMackin
  • Dan Connolly
  • Deb Nicholson
  • Diana Thayer
  • Eric Bavier
  • Eric Schultz
  • Evangelo Stavro Prodromou
  • Evgeni Ku
  • Glenn Thompson
  • James Luke
  • Jonathan Smith
  • Jonathan Wright
  • Justin Sheehy
  • Matt Panhans
  • Michel Lind
  • Mike Ledoux
  • Moto A
  • Nathan TeBlunthuis
  • Nia Bickford
  • Noah Beasley
  • Steve Sprang
  • Travis Smith

Bronze tier

  • Alan Zimmerman
  • Aria Stewart
  • Ben Hamill
  • Benjamin Grimm-Lebsanft
  • Brooke Vibber
  • Brooklyn Zelenka
  • Carl A
  • Crazypedia No
  • Ellie High
  • François Joulaud
  • Gabor Udvari
  • Grant Gould
  • Gregory Buhtz
  • James Smith
  • Jason Wodicka
  • Jeff Forcier
  • Marty McGuire
  • Mason DeVries
  • Michael Orbinpost
  • Neil Brudnak
  • Nelson Pavlosky
  • Philipp Nassua
  • Rodion Goritskov
  • Ron Welch
  • Stefan Magdalinski
  • Stephen Herrick
  • Steven De Herdt
  • Tamara Schmitz
  • Thomas Talbot
  • William Murphy
  • a b
  • chee rabbits
  • r g
  • terra tauri

by Dave Thompson at Wednesday, October 28, 2026

Monday, October 26, 2026

Scheme Requests for Implementation

SRFI 242: The CFG Language

SRFI 242 is now in withdrawn status.

This SRFI defines a language to describe control-flow graphs (CFGs) suitable for formulating iterative and recursive algorithms. Using the notion of a CFG term, this language can be seamlessly embedded in the Scheme language. Complex CFG terms can be composed from simple CFG terms.

by Marc Nieper-Wißkirchen at Monday, October 26, 2026

SRFI 265: The CFG Language

SRFI 265 is now in final status.

This SRFI defines a language to describe control-flow graphs (CFGs) suitable for formulating iterative and recursive algorithms. Using the notion of a CFG term, this language can be seamlessly embedded in the Scheme language. Complex CFG terms can be composed from simple CFG terms.

The language described in this SRFI is not meant to be directly used in programs but by library authors to build abstractions like loop facilities on top of it.

by Marc Nieper-Wißkirchen at Monday, October 26, 2026

Sunday, October 25, 2026

Scheme Requests for Implementation

SRFI 288: Compound Conditions

SRFI 288 is now in draft status.

A condition object system is introduced that attempts to be implementable in and interoperable with many implementation’s condition systems, including the condition system of the R6RS. The condition system includes compound conditions, but does not include subtyping of conditions. Simple conditions can be any implementation-defined value, and are also objects that can be made with the interface in this SRFI. An implementation may add other features, such as introspection and serialization.

by Peter McGoron at Sunday, October 25, 2026

Gwen Weinholt

Akku.scm 1.2.0 released

Akku.scm version 1.2.0, the language package manager for R6RS and R7RS Scheme, is now generally available. It can be downloaded from GitLab. The most important change is a fix to the dependency solver, which was running very slowly due to a bug triggered by the many versions of the chez-srfi package.

Akku is a project-based package manager, where each project has its own set of dependencies. You use .akku/env to set shell variables that let your Scheme implementation know where to find everything.

You can upload your own packages to the archive. They go through a review process to ensure nothing malicious is distributed.

Akku also performs automatic conversion from the R7RS define-library form to the R6RS library form. This lets, e.g., Chez Scheme use R7RS libraries. Packages from the Snow package manager, which has many R7RS packages, are also available via Akku.

Further reading

by weinholt at Sunday, October 25, 2026

Saturday, October 24, 2026

jointhefreeworld

Emacs finally folds to my liking

I’ve been slowly turning my Emacs config into something I actually enjoy using, not just something that works, and folding was the last place where that wasn’t true.

Every mode had its own idea of what folding is: treesit-fold in Tree-sitter modes, Hideshow in the Lisp-ish ones, Outline in everything that resembles text, Org with its own invisible text that no one else’s commands can undo.

So every buffer had different keys, a different look, and worst of all different performance characteristics. Folding a big file sometimes felt like holding my breath.

I’m running Emacs 32.0.50 from master (built from source, as one does), and it’s finally one system.

kirigami is the piece I didn’t know I needed  #

kirigami doesn’t fold anything itself. It dispatches: it keeps a list of folding engines, checks which one is actually active in the buffer, and forwards to it. Tree-sitter, Hideshow, Outline, Org, Vdiff — all behind one interface.

So on top of it I put one set of keys, the same in a Kotlin buffer, YAML, a Scheme or ELisp buffer and an Org file:

Key Does
C-c v c close this fold
C-c v C close every fold
C-c v o open this fold
C-c v O open this fold and everything under it
C-c v r reveal everything
C-c v t toggle the fold at point

That sounds small. It is not small. The number of times a day I used to think “wait, what does TAB do in this mode again” is now zero, and the muscle memory transfers across an entire polyglot config.

One wrinkle worth mentioning: kirigami answers with the first engine in its list whose mode is on, and outline-minor-mode is on in nearly every buffer I have. In the buffers where I deliberately turned on Hideshow — Scheme, for instance — that choice has to win, otherwise C-c v c folds “headings” a Scheme file doesn’t have. So I reorder kirigami-fold-list to put Hideshow first instead of rewriting it; engines kirigami adds later still get used wherever Hideshow is off.

Tree-sitter folding, with guides that are actually lines  #

Most of my programming buffers are *-ts-mode, so treesit-fold does the work there — bash, C, C++, CMake, CSS, Dockerfile, Elixir, Go, HTML, Java, JS/TS/TSX, JSON, Kotlin, Lua, Nix, PHP, Python, Ruby, Rust, Scala, TOML, YAML. Line counts are shown inline, which I find genuinely useful when deciding whether to open a fold.

The indicators took the most fiddling. treesit-fold-indicators draws a block’s guide with a bitmap 23 rows tall, centered in the line beside it. A line in my config is 29 pixels — the font’s 23 plus six of line-spacing — so every row of the guide was a 23-pixel dash with three pixels of nothing above and below it. A folded block looked like a dotted line running down the fringe. Not subtle, just wrong.

There’s no setting for that, so I replaced the bitmaps: a single-row bitmap that define-fringe-bitmap repeats down however tall the line is (no spacing can introduce a gap), plus a +=/-= box and an end-elbow cut to the exact height of a line, so the guide runs from the marker into the row below and turns toward the text where the block ends. It’s an advice on the function that builds the string for each line. It looks like a bracket now, not a perforation.

And the colour: the indicators inherited shadow, which most themes make as bright as a comment. Fine for one marker on one line, wrong for a marker on every line of a block — the grey became a rule drawn through the code. They’re now shadow blended 50% toward the theme’s background, recomputed on every theme and scale change, so it fades correctly on light themes too and no theme needs a special entry.

Hideshow earns its keep  #

Not everything has a grammar, and I’m not going to pretend otherwise:

  • Scheme — my Emacs build has no Scheme grammar, so Scheme buffers use Hideshow with hs-block-start-regexp set to "^(" and hs-forward-sexp-function set to forward-sexp. A Scheme file is a sequence of top-level forms, so each definition is a fold, and collapsing the one you’re inside works from anywhere within it. That’s the behaviour I wanted from the start and Hideshow doesn’t guess it by default.
  • Emacs Lisp — the prog-mode fallback, same keys.
  • XML — folds from start tag to end tag using nxml-scan-element-forward, skipping , comments, DOCTYPE and self-closing elements.
  • YAML (the non-Tree-sitter mode) — indentation-based blocks with a small forward-sexp of my own that walks to the end of the indented block.

Hideshow’s own fringe indicators ( hs-show-indicators + hs-indicator-type 'fringe) are on in all of these, so it doesn’t feel like a downgrade from the Tree-sitter buffers.

The rule I enforce per buffer is exactly one set of indicators: Tree-sitter buffers get treesit-fold and Hideshow is turned off; Hideshow buffers get Hideshow and Outline’s clickable buttons are turned off so the two don’t double up; outline-only buffers (Markdown, diff) keep the buttons. Nobody ends up with two markers per block.

Org, which needed its own everything  #

Org folds with text properties, not overlays, so neither Tree-sitter nor Hideshow nor Outline’s buttons can draw a marker for it. So I wrote its own indicators: a fringe triangle pointing down for an open heading, right for a folded one, clickable with mouse-1 to toggle exactly like TAB. Folding itself is untouched — TAB, S-TAB and the C-c v keys all still work.

The performance part is where the real win is. A naive “redraw indicators after every command” implementation is a disaster in a large file, because it re-searches the buffer and rebuilds every overlay on every pause. Mine is driven by the text instead:

  • if buffer-chars-modified-tick didn’t change, only the indicators that are on screen are redrawn — off-screen headings can wait until they’re scrolled to;
  • if it changed and the change was recorded, only the dirty region is rebuilt;
  • if it changed with no recorded change, only then is the whole buffer rebuilt.

Folding changes text properties rather than characters, so folding alone takes the cheap path. Fold state is read back from Org on each redraw rather than remembered, so external folding can never leave a stale marker.

Two config choices matter just as much: org-fold-core-style is text-properties (so a visibility cycle doesn’t re-parse the file), org-element-use-cache is on, and Org starts with showeverything — which is both what I want (a note is read, not consulted) and the cheaper state, because it skips the visibility passes that walk every heading on open. I also removed a org-restart-font-lock that was re-fontifying the whole buffer a second time on open; JIT-lock handles what’s on screen.

It feels smooth, and that’s the whole point  #

The end result is that folding is boring now. C-c v c in Kotlin, Scheme, Elisp, Org, XML, YAML, Markdown. Guides that look like brackets. Indicators quiet enough to ignore until you need them. No pause on a 3000-line Org file. No two competing markers.

It honestly changes how much I collapse and expand while reading code. I used to avoid folding because it felt fiddly; now it’s free and mouse friendly.

If you want to read the actual code: it’s in dev-folding.el for the engines and indicators, the heks/fold-* wrappers in heks-emacs.el for the keys, and the Org indicators live in org.el. Everything is GPL-3.0, and it’s tested: maak verify asserts a fold actually covers a whole definition and that the documented keys are bound, and maak keys fails on a key that does two jobs or names a command that doesn’t exist.

Happy to answer questions about any of it, especially if you’ve fought the treesit-fold-indicators bitmaps yourself, because that one cost me an evening and I’d love to know if there’s a cleaner way.

Saturday, October 24, 2026