Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New rule: Complement to style/trivial-for #10

Closed
NoahTheDuke opened this issue Apr 29, 2024 · 1 comment
Closed

New rule: Complement to style/trivial-for #10

NoahTheDuke opened this issue Apr 29, 2024 · 1 comment

Comments

@NoahTheDuke
Copy link
Owner

There's style/trivial-for which checks if a symbol is used as a function in a simple for loop: (for [item items] (f item)), but there are cases where a for loop is more readable, such as when building a sequence of new objects by iterating over a collection:

; Don't
(map #(hash-map :a % :b 2 :c 3) coll)

; Do
(for [item coll] {:a item :b 2 :c 3})

Can apply to hash-set and array-map and vector and others as I think of them.

@NoahTheDuke
Copy link
Owner Author

NoahTheDuke commented May 1, 2024

Implemented in 5be04c7

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant