small medium large xlarge

16 Jun 2012, 13:20
Jan-Paul Bultmann (1 post)

I think that instead of doing,

(defn non-blank? [line] (if (re-find #"\S" line) true false))​

a more appropriate solution would be.

(defn non-blank? [line] (boolean (re-find #"\S" line)))

It introduces a new function but prevents newcomers from thinking that (if foo true false) is acceptable style (I personally get cold shivers when reading code like this ;) )

You must be logged in to comment