File tree Expand file tree Collapse file tree 1 file changed +7
-6
lines changed
Expand file tree Collapse file tree 1 file changed +7
-6
lines changed Original file line number Diff line number Diff line change 1010
1111
1212(require racket/list
13- racket/sequence
1413 resyntax/base
1514 syntax/parse
1615 syntax/parse/define)
1918;@----------------------------------------------------------------------------------------------------
2019
2120
21+ ;; Convert an identifier syntax object to its string representation
22+ (define (identifier->string id)
23+ (symbol->string (syntax-e id)))
24+
25+
2226;; Check if a list of identifiers is sorted alphabetically by their symbol names
2327(define (identifiers-sorted? ids)
24- (define id-list (sequence->list ids))
25- (define id-strings (map (λ (id) (symbol->string (syntax-e id))) id-list))
28+ (define id-strings (map identifier->string ids))
2629 (equal? id-strings (sort id-strings string<?)))
2730
2831
2932;; Sort a list of syntax objects representing identifiers alphabetically
3033(define (sort-identifiers ids)
31- (sort (sequence->list ids)
32- string<?
33- #:key (λ (id) (symbol->string (syntax-e id)))))
34+ (sort ids string<? #:key identifier->string))
3435
3536
3637;; Syntax class for matching a list expression with identifier elements
You can’t perform that action at this time.
0 commit comments