Clojure style (and good software development in general) focuses on many small features, a subset of which are openly accessible to the external interface.
In Clojure, there seem to be several ways to do this:
(letfn [(private-a ...) (private-b ...)] (defn public-a ...) (defn public-b ...)) (defn- private-a ...) (defn- private-b ...) (defn public-a ...) (defn public-b ...)
The letfn form looks more verbose and perhaps less flexible, but it reduces the scope of functions.
I assume letfn is only for use inside other forms when small helper functions are used only in a small area. Is that a consensus? Should it ever be used at the top level (as I saw earlier)? When should it be used?
coding-style clojure
rybern
source share