On Tue, Jun 3, 2014 at 8:32 AM, Gregg Reynolds <d...@mobileink.com> wrote:
>
>
>
> On Sun, Jun 1, 2014 at 9:36 AM, Glen Mailer <glenja...@gmail.com> wrote:
>
>> Hi everyone, I'm looking to get some opinions on code style.
>>
> ...

> 4.  Put your helper funcs ("defn-" stuff) in helpers.clj, without a call
> to ns at the top, then (load "helpers") at the top of the file that uses
> them.  You still get the effect you're looking for, with a one line
> "preface" that tells the reader where to look for more info.  Seems to work
> in a little test app (lein new app topdown):
>
> ;; in topdown/core.clj:
> (ns topdown.core
>   (:gen-class))
>
> (load "helpers")
>
> (defn -main
>   "I don't do a whole lot, but I do call an internal function that lives
> in another source file."
>   [& args]
>   (hello))
>
> ;; in topdown/helpers.clj:
> ;; internal topdown helper fns
>
> (defn- hello [] (println "Hello"))
>

PS.  You can also do:

;; in topdown/core.clj
(ns topdown.core
  (:load "helpers"))
... etc...

;; in helpers.clj
(ns topdown.core)
(defn- hello [] (println "Hello "))

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to