Keyed Patterns for Guile: Map Destructuring After Racket and Clojure
Table of Contents
A draft for the proposal shelf. Not submitted anywhere. Status: Proposed; the library does not exist yet.
1. Pitch
Racket's match destructures hash tables. Clojure 1.13 hands back what was
missing as data. Guile's (ice-9 match) does neither. Build it, and report
which choices survive on a Scheme with mutable tables.
2. Abstract
Three Lisps, three answers to one question: what does a function say about
the map it is given? Racket's hash* pattern binds by key, takes defaults,
binds the rest, and can be closed. Clojure 1.13 adds checked keys and
directives that return the selected, excess and missing entries as data, and
declines to offer a closed mode. Guile's (ice-9 match) has no hash-table
pattern at all, and matches association lists only by position. This paper
describes a Guile library that adds keyed patterns over hash tables and
association lists, and uses the build to compare the designs: which features
depend on persistent maps, which on a macro system, and which are free.
3. Audience, format, venue
- Audience
- Scheme implementers and users; people who follow pattern matching across the Lisp family.
- Format
- Scheme Workshop paper with a 20-minute talk; an ELS lightning talk as a first outing.
- Where
- The Scheme Workshop at ICFP, the European Lisp Symposium. RacketCon only as a comparison talk.
4. What exists and what does not
Run on Racket 8.15, Guile 3.0.10 and Clojure 1.13.0-alpha8 on 2026-10-01:
| Feature | Clojure 1.13 | Racket match |
Guile (ice-9 match) |
|---|---|---|---|
| Bind by key from a map | :keys |
hash*, hash-table |
no |
| Default for an absent key | :or |
#:default |
no |
| Absent key is an error | :keys! |
the default: no match | no |
| The unmentioned entries, as data | :excess |
#:rest |
no |
| Reject unmentioned entries | not offered | #:closed |
no |
| Absent keys collected as data | :missing |
no | no |
The comparison is done. The library is not started. It would live as a
guile-* project beside the other Guile work.
5. Risks
- It is a proposal for work, not a report of it. Nothing to submit until the library exists and has tests.
- SRFI 204 and existing third-party matchers may already cover part of this. Not yet checked; a paper needs that survey first.
- Clojure 1.13 is alpha. The comparison column must be re-run on the release.
6. Backing
Public repositories:
- None yet.
Notes on this site:
- Clojure/Conj 2026 notes, for the Clojure 1.13 directives.
- RacketCon 2025 notes: a match-like DSL for deep immutable updates was on that program.