DEV Community

loading...

Discussion on: Simple ways to improve code readability

Collapse
theodesp profile image
Theofanis Despoudis

I think sometimes, a change of paradigm can make things more obvious. For example in Clojure

(def ids [1 2 3 4 5])
(defn retrieve [id]
  (when (contains? ids id) 
     (retrieveItemById id)))

It is quite readable as the vocabulary of functions are more relevant.

Collapse
briwa profile image
briwa Author

Haven't tried Clojure but boy that is a whole new level of readability. Thanks for the tips. I agree, this article is merely baby steps to something bigger like switching to Clojure.