File tree Expand file tree Collapse file tree 2 files changed +22
-0
lines changed
Expand file tree Collapse file tree 2 files changed +22
-0
lines changed Original file line number Diff line number Diff line change @@ -179,3 +179,16 @@ test: "used map expression not refactorable to for-each"
179179(define (f func xs ys zs)
180180 (map func xs ys zs))
181181------------------------------
182+
183+
184+ test: "build-list with const refactorable to make-list "
185+ ------------------------------
186+ (require racket/function
187+ racket/list)
188+ (build-list 5 (const 42 ))
189+ ------------------------------
190+ ------------------------------
191+ (require racket/function
192+ racket/list)
193+ (make-list 5 42 )
194+ ------------------------------
Original file line number Diff line number Diff line change 1010
1111
1212(require (for-syntax racket/base)
13+ racket/function
1314 racket/list
1415 racket/set
1516 rebellion/private/static-name
132133 (body-before ... (~replacement (for-each proc list ... ) #:original map-expr) body-after ... ))
133134
134135
136+ (define-refactoring-rule build-list-const-to-make-list
137+ #:description "Using `build-list` with `const` is equivalent to using `make-list`. "
138+ #:literals (build-list const)
139+ (build-list count (const elem))
140+ (make-list count elem))
141+
142+
135143(define-refactoring-suite list-shortcuts
136144 #:rules (append-single-list-to-single-list
137145 append*-and-map-to-append-map
146+ build-list-const-to-make-list
138147 equal-null-list-to-null-predicate
139148 filter-to-remove*
140149 filter-to-remq*
You can’t perform that action at this time.
0 commit comments