r/Clojure • • Jun 06 '20

[BLOGPOST] Idiomatic Clojure: Code Smells

https://bsless.github.io/code-smells/
85 Upvotes

27 comments sorted by

View all comments

Show parent comments

4

u/fiddlerwoaroof Jun 07 '20

When I’m reading/reviewing code, I don’t want to have to think carefully about ambiguous constructs: I’d rather encourage a style that avoids ambiguity like this as much as possible.

3

u/bsless Jun 07 '20 edited Jun 07 '20

I've had the displeasure of seeing a 4-deep doseq with two let bindings and a when clause.

It gave me great appreciation for the rich syntax offered by for and doseq.

Also unmentioned, when using nested for, the programmer is forced to use concat, when what they wanted was just a Cartesian product.

2

u/fiddlerwoaroof Jun 07 '20

Yeah, I tend to the mindset of "just use transducers". I never use for/doseq in my own code, because the compositionality of transducers make them a lot nicer.

1

u/bsless Jun 07 '20

Agreed. Still working on familiarizing my coworkers with transducers. I have a series on those in the works.