resyntax
resyntax copied to clipboard
Keeping marked lists sorted
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.