I suspect that *command-line-arguments* would have "myapp.clj" as the 0th element in the clj myapp.clj Can't test right now though sorry.
On Jan 3, 3:34 am, "Mark Volkmann" <[email protected]> wrote: > I have a file of Clojure code that I'd like to experiment with in the > REPL. I use (load file-path) to do that and then I can try out the > functions it defines. At the bottom of the file it calls the functions > required to run my application. Is there a way I can write the code so > it only runs my application when I run it outside the REPL? > > For example, this should run the application: > > clj myapp.clj > > and this should not: > > clj > user=> (load-file "myapp.clj") > > Ruby has something like this. You surround the code that runs the app like > this: > > if $PROGRAM_NAME == __FILE__ > # code to run application goes here > end > > -- > R. Mark Volkmann > Object Computing, Inc. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/clojure?hl=en -~----------~----~----~----~------~----~------~--~---
