On May 30, 12:18 pm, Stuart Halloway
wrote:
> Hi jbs,
>
> Not sure why the title of this post is about "size" instead of "protection",
> but why don't you just use private functions in Clojure?
>
> (defn- my-little-helper [] "visible only in my namespace" ...)
>
> Note the "-" on the end of def
You can bind functions inside a let, which can help if you're just
trying to make code less nested. The thread-first and thread-last
macros help here too. But if you're looking for the equivalent of the
"private" keyword (sort of) check out defn-. Note the dash at the
end.
On Sunday, May 30, 2010
Hi jbs,
Not sure why the title of this post is about "size" instead of "protection",
but why don't you just use private functions in Clojure?
(defn- my-little-helper [] "visible only in my namespace" ...)
Note the "-" on the end of defn, which is idiomatic for introducing a private
var. You ca