resyntax icon indicating copy to clipboard operation
resyntax copied to clipboard

Replace `build-list` with `for/list`

Open jackfirth opened this issue 1 year ago • 0 comments

#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.

jackfirth avatar Nov 05 '24 00:11 jackfirth