Re: doc strings for both interfaces and concrete implementations

2012-07-30 Thread Tassilo Horn
Warren Lynn 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 agree th

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

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 pointe

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 lo

Re:

2012-07-30 Thread Ben Smith-Mannschott
On Sun, Jul 29, 2012 at 3:07 PM, John Holland 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 Halloway's by-pairs fun

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 for

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.

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 to

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.Number

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 bec

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 C

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 message

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 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 one; > '(apply #(or

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 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. To post to this 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 cl

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 sup

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 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. > > https://docs.google.com/spreadsheet/ccc?key=0AjcJV_bAT0m_dHVPY0lZZlZvbElyVG

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 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 more mature than

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 : > On Mon, J

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) (swank.core/

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 th

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 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 feature? > Does Co

Re: JDBC Timezone Issue

2012-07-30 Thread Sean Corfield
On Fri, Jul 27, 2012 at 10:42 AM, Jestine Paul 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 having this issue?

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 wrote: > On Mon, Jul 30, 2012 at 6:55 PM, Moritz Ulrich > 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 proposal is: ((some-fn :k1 :k2) m) Whic

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 wrote: > On Tue, Jul 31, 2012 at 1:08 AM, Aaron Cohen wrote: >> On Mon, Jul 30, 2012 at 6:55 PM, Moritz Ulrich >> wrote: >>> (some identity ((juxt :k1 :k2) m)) is the first thing I can think of. >> >> For even more fun, try (some m [:k1 :k2]

Re: swap! and atom behavior

2012-07-30 Thread Vinay D.E
Hi Evan, Thanks for the reply. I tried putting a print and it works as expected. (let [a (atom 0) i (take-while (fn[x] (swap! a inc) (< x 100)) [1 2 3 4 5])] (println i) [@a i]) ;; <== [5 (1 2 3 4 5)] But, I still cant come up with a theory of what exactly i

Re: swap! and atom behavior

2012-07-30 Thread Carlo Zancanaro
> 1) I assumed that printing out [i @a] instead of [@a i] should realize 'i' > first and @a should be correctly displayed as 5. This does not happen, it > simply prints [(1 2 3 4 5) 0] if the order is reversed. So, this evaluates in two "stages". First the terms `i` and `@a` are evaluated to get

Re: swap! and atom behavior

2012-07-30 Thread Sean Corfield
On Mon, Jul 30, 2012 at 11:05 PM, Vinay D.E wrote: > I tried putting a print and it works as expected. Because you are realizing the whole of i to print it. > 1) I assumed that printing out [i @a] instead of [@a i] should realize 'i' No, [i @a] creates a two-element vector of a lazy-seq and a v