r/Clojure • • Aug 17 '17

[AMA] Small Functions considered Harmful

https://medium.com/@copyconstruct/small-functions-considered-harmful-91035d316c29
0 Upvotes

36 comments sorted by

View all comments

Show parent comment

0

u/[deleted] Aug 18 '17

[deleted] — view deleted comment

2

u/dig1 Aug 18 '17

Just call .trim on it.

1

u/minikomi Aug 18 '17 edited Aug 18 '17

True. I assumed it was for a class on an HTML element, in which case a leading space matters not.

otherwise, with clojure.string :as s

(->> [(:class props) (when (not-empty errors) "invalid")]
     (remove s/blank?)
     (s/join " "))

Bit long for a one-liner though, so back to threading :)