resyntax
resyntax copied to clipboard
Replace `build-list` with `for/list`
#lang resyntax/test
test: "build-list and explicit lambda should be refactored to for/list"
--------------------
#lang racket
(define (f n)
(build-list n (lambda (i) (+ i (* i 2)))))
--------------------
--------------------
#lang racket
(define (f n)
(for/list ([i (in-range n)])
(+ i (* i 2))))
--------------------
Should be similar to the for-each and map rules, where it only fires if the function given to build-list is sufficiently complex.