Improve quasiquote/unquote-splicing for better macro authoring #63

Open
opened 2026-02-07 17:12:55 +00:00 by navicore · 0 comments
navicore commented 2026-02-07 17:12:55 +00:00 (Migrated from github.com)

Summary

Ensure quasiquote expansion with unquote-splicing works robustly enough to support writing complex macros, especially for the self-hosted standard library.

Motivation

seq-lisp-2 has a clean expand-quasiquote implementation with full splice support. Writing macros with quasiquote is much more natural than building list structure with list and cons:

;; Without quasiquote — verbose
(defmacro when (test body)
  (list 'if test body #f))

;; With quasiquote — natural
(defmacro when (test body)
  `(if ,test ,body #f))

This becomes especially important for variadic macros (e.g., (and a b c ...)) and the self-hosted standard library.

Scope

  • Audit current quasiquote/unquote/unquote-splicing implementation for edge cases
  • Ensure ,@ works correctly in all positions (beginning, middle, end of list)
  • Test with realistic macro definitions from the planned stdlib
  • Fix any issues found

Notes

seq-lisp already has quasiquote support, so this may just be a matter of testing and fixing edge cases rather than a new implementation. Most valuable in combination with the self-hosted stdlib effort.

Inspired by seq-lisp-2/src/eval.seq expand-quasiquote.

## Summary Ensure quasiquote expansion with unquote-splicing works robustly enough to support writing complex macros, especially for the self-hosted standard library. ## Motivation seq-lisp-2 has a clean `expand-quasiquote` implementation with full splice support. Writing macros with quasiquote is much more natural than building list structure with `list` and `cons`: ```lisp ;; Without quasiquote — verbose (defmacro when (test body) (list 'if test body #f)) ;; With quasiquote — natural (defmacro when (test body) `(if ,test ,body #f)) ``` This becomes especially important for variadic macros (e.g., `(and a b c ...)`) and the self-hosted standard library. ## Scope - Audit current quasiquote/unquote/unquote-splicing implementation for edge cases - Ensure `,@` works correctly in all positions (beginning, middle, end of list) - Test with realistic macro definitions from the planned stdlib - Fix any issues found ## Notes seq-lisp already has quasiquote support, so this may just be a matter of testing and fixing edge cases rather than a new implementation. Most valuable in combination with the self-hosted stdlib effort. Inspired by `seq-lisp-2/src/eval.seq` `expand-quasiquote`.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
navicore/seq-lisp#63
No description provided.