Skip to content

New rule: flatten-apply-append-syntax-template #769

@jackfirth

Description

@jackfirth

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    autopilot-candidateThe Copilot Agent should attempt this during a scheduled Autopilot runnew lintIssues suggesting new lints or pull requests implementing new lints

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions