Re: Idiomatic way to reference a bundled data file from Clojure source?

2011-06-29 Thread Shantanu Kumar
The idiomatic way may be to include the file(s) in the classpath and there is already a `resource` function in clojure.java.io that can load it from the classpath: $ lein new foo $ cd foo $ mkdir resources $ catresources/test.txt hello world foo bar ^D $ # edit src/foo/core.clj as follows (ns

Idiomatic way to reference a bundled data file from Clojure source?

2011-06-28 Thread stu
Hi, I'd like to bundle a collection of (JSON) datafiles with a Clojure project source tree so that Clojure functions can reliably find and open those datafiles. What's the idiomatic way of going about this? In the past with other languages I've used tricks like Ruby's .dirname(__FILE__)/...

Re: Idiomatic way to reference a bundled data file from Clojure source?

2011-06-28 Thread Dave Ray
Hey, I don't have a good example, but the right way to do is with resources which are basically just files that live on the classpath: * Put the files in a folder on your classpath. If your using leiningen, the resources/ directory does this by default. * Get a URL to the file with

Re: Idiomatic way to reference a bundled data file from Clojure source?

2011-06-28 Thread Stephen C. Gilardi
I'd like to bundle a collection of (JSON) datafiles with a Clojure project source tree so that Clojure functions can reliably find and open those datafiles. What's the idiomatic way of going about this? One idiomatic way to do this in Clojure is: - store the files within a directory

Re: Idiomatic way to reference a bundled data file from Clojure source?

2011-06-28 Thread stu
On Jun 29, 12:17 pm, Stephen C. Gilardi squee...@mac.com wrote: I'd like to bundle a collection of (JSON) datafiles with a Clojure project source tree so that Clojure functions can reliably find and open those datafiles. What's the idiomatic way of going about this? Many thanks to