Skip to content

Keeping marked lists sorted #499

@jackfirth

Description

@jackfirth

It should be possible to tell Resyntax to keep specific collections in sorted order. This could be done with a keep-sorted macro by making a Resyntax rule that looks for a syntax property added by the macro. The first form in the list should be ignored so that this works with any collection, like (list ...), (set ...), or (vector ...). The comparator used could also be customizable by the keep-sorted macro, but it has to be something that operates on the syntax objects contained, not their values.

#lang resyntax/test

test: "unsorted marked list should be resorted"
--------------------
#lang racket
(keep-sorted (list apple orange banana))
--------------------
--------------------
#lang racket
(keep-sorted (list apple banana orange))
--------------------

It should be a macro so that other macros can expand to it. I want this so that define-refactoring-suite can specify that the list of refactoring rules should always be written in sorted order.

Metadata

Metadata

Assignees

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