jackfirth / resyntax

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

Suggest using the keyword arguments of `string-join` #175

Closed jackfirth closed 1 year ago

jackfirth commented 1 year ago

Saw this code today:

(string-append
 " | Package: "
 (string-join (map ~a from-pkgs) ", "))

The outer string-append can be removed by using the #:before-first keyword argument of string-join like this:

(string-join (map ~a from-pkgs) ", " #:before-first " | Package: ")

This is easier to understand and makes it easy to fit on one line if the expressions are small. Resyntax should suggest using #:before-first and #:after-last instead of using string-append in this manner.