Liking cljdoc? Tell your friends :D

Naming

naming/conversion-functions

Enabled by defaultVersion AddedVersion Updated
true0.1.940.1.94

Use -> instead of to in the names of conversion functions.

Examples

# bad
(defn f-to-c ...)

# good
(defn f->c ...)

Reference

  • [https://guide.clojure.style/#naming-conversion-functions]

naming/predicate

Enabled by defaultVersion AddedVersion Updated
true0.1.690.1.94

Functions that return a boolean should end in a question mark.

Doesn't verify the kind of function, just checks for anti-patterns in the names. Also doesn't actually check the classic Common Lisp convention as we have no way to know when a function name uses a word that naturally ends in a 'p' (such as map).

Examples

# bad
(defn palindrome-p ...)
(defn is-palindrome ...)

# good
(defn palindrome? ...)

Reference

  • [https://guide.clojure.style/#naming-predicates]

naming/record-name

Enabled by defaultVersion AddedVersion Updated
true0.1.691.0

Records should use PascalCase.

Examples

# bad
(defrecord foo [a b c])

# good
(defrecord Foo [a b c])

Reference

  • [https://guide.clojure.style/#naming-protocols-records-structs-and-types]

Can you improve this documentation?Edit on GitHub

cljdoc is a website building & hosting documentation for Clojure/Script libraries

× close