Re: How to add an URL into the classpath?

2012-07-30 Thread Yoshinori Kohyama
Hello clojurians, It seems not to be able to control the whole classpath of my runtime. But my aim, compiling with a path given at runtime and execute it, has been achieved, with (.setContextClassLoader (Thread/currentThread) (DynamicClassLoader. (.getContextClassLoader

Re: How to add an URL into the classpath?

2012-07-30 Thread Yoshinori Kohyama
I forgot to show foo/core.clj $ cat samples/src/foo/core.clj (ns foo.core) (defn -main [ args] (loop [] (println Foo: (apply str (interpose args))) (Thread/sleep 1000) (recur))) -- You received this message because you are subscribed to the Google Groups Clojure group. To

Re: doc strings for both interfaces and concrete implementations

2012-07-30 Thread Tassilo Horn
Warren Lynn wrn.l...@gmail.com writes: In general, all different versions of a function should somehow do the same thing, so with separate docstrings you'd need to repeat yourself. A good guideline is to write the big picture first, followed by the meaning of the different parameters. I

Re: help with lein-localrepo

2012-07-30 Thread Samrat Man Singh
Thanks, it is working now. Neither seems to work for me. To, my project.clj I tried adding both [goose 2.1.19] and [com.gravity/goose 2.1.19], but in the On Monday, July 30, 2012 4:07:12 AM UTC+5:45, Shantanu Kumar wrote: On Sunday, 29 July 2012 17:37:40 UTC+5:30, Samrat Man Singh wrote:

Re: help with lein-localrepo

2012-07-30 Thread Samrat Man Singh
Thanks, it's working now. On Monday, July 30, 2012 4:07:12 AM UTC+5:45, Shantanu Kumar wrote: On Sunday, 29 July 2012 17:37:40 UTC+5:30, Samrat Man Singh wrote: I want to use goose(https://github.com/jiminoc/goose) in a Clojure project and found a StackOverflow answer that pointed me to

Testing ClojureScript

2012-07-30 Thread Timothy Baldridge
I'm trying to run the tests for ClojureScirpt under Ubuntu 12.04. I installed libmozjs, set the spidermonkey_home variable then ran script/test and got this: tim@tim-desktop:~/clojurescript$ script/test V8_HOME not set, skipping V8 tests Testing with SpiderMonkey Error: unrecognized flag -m Try

Re: Experiences developing a crowdfunding site for open source projects in Clojure (from a Python background)

2012-07-30 Thread Samrat Man Singh
I got an error when I went to the link, you posted in the original post. On Monday, July 30, 2012 1:08:40 AM UTC+5:45, Aaron Lebo wrote: Hi Samrat. Could you explain how you are trying to access the site (address) and what is happening? I started out in noir, and ended up using a lot of

Re:

2012-07-30 Thread Ben Smith-Mannschott
On Sun, Jul 29, 2012 at 3:07 PM, John Holland jbholl...@gmail.com wrote: I'm doing some exercises in coding that are meant for Java but I'm doing them in Clojure. I'm stuck on this one. The goal is to return true if an array of ints contains two consecutive 2s. I figured I'd use Stuart

Re: Testing ClojureScript

2012-07-30 Thread David Nolen
Looks like Node.js is being aliased as SpiderMonkey. That won't work. I suggest installing V8 from source. I'll update the ClojureScript Github wiki with instructions for testing latest JavaScriptCore and SpiderMonkey. David On Monday, July 30, 2012, Timothy Baldridge wrote: I'm trying to run

Re:

2012-07-30 Thread DeWitt Clinton
I really like the 'partition' technique. That said, as a non-expert, I find the recursive approach marginally easier to read: (defn has22 [coll] (when-let [s (seq coll)] (or (= 2 (first s) (second s)) (recur (rest s) In my microbenchmarks, the above technique runs about 5-10x faster

A question on Clojure precision

2012-07-30 Thread grahamke
I was testing some of the code in Miclael Fogus Chris Houser's The Joy of Clojure and found this: Clojure 1.4.0 user= (let [a (+ 0.1 0.1M 0.1M 0.1M 0.1M 0.1M 0.1M 0.1M 0.1M 0.1M)] (println (class a)) a) java.lang.Double 0. user= (let [b (+ 0.1M 0.1M 0.1M 0.1M 0.1M 0.1M 0.1M

Re:

2012-07-30 Thread nicolas.o...@gmail.com
Another one. (The exception is for early termination) (def found! (Exception.)) (defn has22 [l] (try (reduce #(and (= 2 %2) (or (not %1) (throw found!))) false l) false (catch Exception e true))) -- You received this message because you are subscribed

Re: A question on Clojure precision

2012-07-30 Thread Kevin Ilchmann Jørgensen
Hey Does the part about numbers: http://clojure.org/data_structures clear it up for you? From (source +) you should see that (+ 0.1 0.1M ...) is matched to (. clojure.lang.Numbers (add x y))) ; (. clojure.lang.Numbers (add 0.1 0.1M)) =0.2 and that (+ 0.1M 0.1M ...) is (. clojure.lang.Numbers

Re: Experiences developing a crowdfunding site for open source projects in Clojure (from a Python background)

2012-07-30 Thread John Gabriele
On Sunday, July 29, 2012 3:45:00 PM UTC-4, Aaron Lebo wrote: Here's PEP 8 as an example of what I'm talking about: http://www.python.org/dev/peps/pep-0008/ Perhaps this might be useful: http://dev.clojure.org/display/design/Library+Coding+Standards ---John -- You received this message

Re: Clojurians in the midlands (UK)

2012-07-30 Thread Simon Holgate
Jim, this is really great! I have joined the google group and I'm looking forward to the next meetup! Great! Welcome to the group! as the website suggests i will keep an eye on the time and place as it says it is not always fixed...too bad I missed the clojurescript talk :( Yep, the

Alternative to (or (:k1 m) (:k2 m))

2012-07-30 Thread Michael Gardner
Is there an elegant way to say '(or (:k1 m) (:k2 m)), without repeating m? Using a let can be awkward if the expression isn't already wrapped in one; '(apply #(or %1 %2) (map m [:k1 :k2])) is similarly bad. Hopefully there's something clever I'm missing; any ideas? -- You received this

Re: Alternative to (or (:k1 m) (:k2 m))

2012-07-30 Thread Moritz Ulrich
(some identity ((juxt :k1 :k2) m)) is the first thing I can think of. On Tue, Jul 31, 2012 at 12:48 AM, Michael Gardner gardne...@gmail.com wrote: Is there an elegant way to say '(or (:k1 m) (:k2 m)), without repeating m? Using a let can be awkward if the expression isn't already wrapped in

Re: Alternative to (or (:k1 m) (:k2 m))

2012-07-30 Thread Aaron Cohen
On Mon, Jul 30, 2012 at 6:55 PM, Moritz Ulrich ulrich.mor...@gmail.com wrote: (some identity ((juxt :k1 :k2) m)) is the first thing I can think of. For even more fun, try (some m [:k1 :k2]) :) --Aaron -- You received this message because you are subscribed to the Google Groups Clojure group.

Re: Alternative to (or (:k1 m) (:k2 m))

2012-07-30 Thread Michael Gardner
On Jul 30, 2012, at 6:08 PM, Aaron Cohen wrote: For even more fun, try (some m [:k1 :k2]) :) Wow, that's perfect. It even works with string keys! Thanks, guys. -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to

Re: ANN: Mongoika, a new Clojure MongoDB library

2012-07-30 Thread Tokusei NOBORIO
Have you taken a look at other libraries such as CongoMongo I used CongoMongo in the past, And decided I need a library with more features. This is why I wrote Mongoika. Monger also lets you work with query cursors as lazy sequences, uses Mongo shell syntax for queries with maps and supports

Re: ANN: Mongoika, a new Clojure MongoDB library

2012-07-30 Thread Sean Corfield
On Mon, Jul 30, 2012 at 5:12 PM, Tokusei NOBORIO t.nobo...@gmail.com wrote: Here is a comparison of the features of the three libraries. I hope people will correct any mistakes, and point out any important features I have forgotten.

Re: ANN: Mongoika, a new Clojure MongoDB library

2012-07-30 Thread Sean Corfield
On Mon, Jul 30, 2012 at 5:12 PM, Tokusei NOBORIO t.nobo...@gmail.com wrote: I used CongoMongo in the past, And decided I need a library with more features. What features were missing? Always interested in making CongoMongo better - since there's a whole team of contributors :) It seems to be

Re: ANN: Mongoika, a new Clojure MongoDB library

2012-07-30 Thread Tokusei NOBORIO
Thank you for explaining this to me. I didn't know that CongoMongo had these features. I have updated the feature comparison spreadsheet. Is it okay now? Does CongoMongo have anything like Mongoika's map-after feature? https://github.com/yuushimizu/Mongoika 2012/7/31 Sean Corfield

atom / swap! question

2012-07-30 Thread Vinay D.E
I am a newbie and was doing some exercises when I ran across something that I don't understand. I am trying to count the number of elements in an array less than 100. My first attempt didn't work. The counter returns 0 (let [a (atom 0) i (take-while (fn[x] (swap! a inc) ( x 100)) [1 2 3

swap! and atom behavior

2012-07-30 Thread Vinay D.E
Hi, I am a clojure newbie. I was working through some examples when I discovered some behavior that I cant understand. swap! behavior changes with the context it is used in. If I put it in a 'take-while', swap! doesnt work : (let [a (atom 0) i (take-while (fn[x] (swap! a inc)

Re: swap! and atom behavior

2012-07-30 Thread Evan Mezeske
The problem is that take-while is lazy, so it does not actually perform the taking operation until the lazy-seq it returns is realized, e.g. by being printed. So when your code binds the (take-while ...) expression to i, the anonymous function you provided is not yet being invoked, and thus

Re:

2012-07-30 Thread Yoshinori Kohyama
Hi Nicolas, The technique, using throw an Exception when succeeded in searching, strikes me! Not idiomatic but very practical. It's like a break in a loop of imperatives. I may use it somewhere. Thank you. Regards, Yoshinori Kohyama -- You received this message because you are subscribed to

Re: ANN: Mongoika, a new Clojure MongoDB library

2012-07-30 Thread Sean Corfield
On Mon, Jul 30, 2012 at 7:14 PM, Tokusei NOBORIO t.nobo...@gmail.com wrote: I have updated the feature comparison spreadsheet. Is it okay now? Thanx. It's still says 'n' for connection pooling - but that's built into the Java driver that CongoMongo uses so I'm not sure how you're defining that

Re: JDBC Timezone Issue

2012-07-30 Thread Sean Corfield
On Fri, Jul 27, 2012 at 10:42 AM, Jestine Paul jestine.p...@gmail.com wrote: I have raised a JIRA issue (JDBC-35) regarding the timezones returned from the ResultSet getter method. http://dev.clojure.org/jira/browse/JDBC-35 I'm a bit surprised no one has responded to this. Maybe no one else is

Re: Alternative to (or (:k1 m) (:k2 m))

2012-07-30 Thread Ben Smith-Mannschott
On Tue, Jul 31, 2012 at 1:08 AM, Aaron Cohen aa...@assonance.org wrote: On Mon, Jul 30, 2012 at 6:55 PM, Moritz Ulrich ulrich.mor...@gmail.com wrote: (some identity ((juxt :k1 :k2) m)) is the first thing I can think of. For even more fun, try (some m [:k1 :k2]) :) The flip side of this

Re: Alternative to (or (:k1 m) (:k2 m))

2012-07-30 Thread Ben Smith-Mannschott
On Tue, Jul 31, 2012 at 7:00 AM, Ben Smith-Mannschott bsmith.o...@gmail.com wrote: On Tue, Jul 31, 2012 at 1:08 AM, Aaron Cohen aa...@assonance.org wrote: On Mon, Jul 30, 2012 at 6:55 PM, Moritz Ulrich ulrich.mor...@gmail.com wrote: (some identity ((juxt :k1 :k2) m)) is the first thing I can