Re: Is there a function to determine if code is run as script or library ?

2014-02-27 Thread GeekyCoder
Hi, Aaron, Rob thank for the reply. I actually thinking that something that is straightforward and less involving (without daemon or lein). What happen is that I like to write a script in intellij editor, and then choose run, clojure will check for main function in current file , and invoke

Re: Is there a function to determine if code is run as script or library ?

2014-02-26 Thread Rob Day
'lein run -m ' will run the "main-" function of a namespace, which otherwise won't be run unless deliberately invoked (like all functions). Is that what you're looking for? (See https://github.com/technomancy/leiningen#basic-usage). On 26 February 2014 09:57, Aaron France wrote: > > Hi, > > > Yo

Re: Is there a function to determine if code is run as script or library ?

2014-02-26 Thread Aaron France
Hi, You can implement https://github.com/clojure-cookbook/my-daemon for your application. I've had great success with this. Aaron On Wed, Feb 26, 2014 at 01:50:43AM -0800, macdevign mac wrote: >Hi, >is there a function to determine if the clojure code is running as library >or as s

Is there a function to determine if code is run as script or library ?

2014-02-26 Thread macdevign mac
Hi, is there a function to determine if the clojure code is running as library or as script ? In ruby, there is if __FILE__==$0 # this will only run if the script was the main, not load'd or require'dend In Java, we could include main method in class, and choose to run it, How about cloju