Clojure – good coding guidelines
– only lower case letters separated by hyphens except types and protocols should be named in camelcase
– predicates ends with ?
– destructive functions ends with !
– variables that are meant for be re-binding should have earmuffs
– use “_” for names that will be ignored by the code
Code Structure :
– when there is only “then” clause in a conditional statement use “when” instead of “if”
– put all trailing parenthesis in one line
– for dependency use “:only” for “use” and “require”
– use two spaces for indentation
– destructure arg list only when you want to explain the structure of arg to caller otherwise destructure in first let binding
– try to solve a problem by using function before trying with macro
– be lazy when possible
– use keywords as keys for map entries
– use keyword-first syntax to access properties on objects
– prefer sequence library functions instead of loop/recurr
– only use anonymous functions for short function definitions that fit comfortably on a single line. Otherwise create a private, named function.
– short functions