resyntax
resyntax copied to clipboard
New rule: `flatten-apply-append-syntax-template`
Rule summary
The code (apply append (map syntax->list (syntax->list #'((id ...) ...)))) is more directly expressed as (syntax->list #'(id ... ...)).
Test case
#lang resyntax/test
test: "original code should be refactorable to new code"
--------------------
#lang racket
(define (f stx)
(with-syntax ([((a ...) ...) stx])
(apply append
(map syntax->list (syntax->list #'((a ...) ...))))))
====================
#lang racket
(define (f stx)
(with-syntax ([((a ...) ...) stx])
(syntax->list #'(a ... ...))))
--------------------
Additional context
Saw this here in racket/drracket#783.