(define (expand* lst)
  (append-map (lambda (item)
                (match (expand item)
                  ((? pair? p)
                   (cons item (expand* p)))
                  (_ (list item))))
              lst))

Generated by Ricardo Wurmus using scpaste at Sun Oct 23 09:56:47 2022. CEST. (original)