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 clojure@googlegroups.com
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to