jackfirth / resyntax

A Racket refactoring engine
Apache License 2.0
58 stars 10 forks source link

Suggest `for*` instead of nested `for` forms #156

Closed jackfirth closed 2 years ago

jackfirth commented 2 years ago

Saw this code today:

(for ([non-term (in-list (send g get-non-terms))])
  (for ([prod (in-list (send g get-prods-for-non-term non-term))])
    body ...))

That can be simplified to use for* instead:

(for* ([non-term (in-list (send g get-non-terms))]
       [prod (in-list (send g get-prods-for-non-term non-term))])
  body ...)

A lint for this should collapse any number of single-clause for forms.