Re: Not using dependency injection - how do I share services around?

2013-05-11 Thread Sean Corfield
Korny mentioned java.jdbc and I figured that was a good in to talk about how we use it at World Singles. Even with the old API we used a function in a specific namespace that returned the data source (in fact it returned a pooled data source, using c3p0). Behind the scenes, we actually use an atom

Why is using (not (empty? coll)) not idiomatic?

2013-05-11 Thread Nico Balestra
I'm not sure this question has been asked already, but I really want to know the principle behind (not (empty? coll)) not being idiomatic. I find it much more readable than (seq coll) and I don't understand why (empty?) exists if it's not idiomatic. But my real doubt is: What's the idiom in (seq

Re: Not using dependency injection - how do I share services around?

2013-05-11 Thread Chris Ford
Sounds to me like there's enough meat in this topic for someone to consider submitting a talk to the upcoming EuroClojure http://euroclojure.com/2013/ or Clojure/conj http://clojure-conj.org/ on what Clojure means for DI. It's a commonly asked question, and it could be an opportunity for The

Re: Not using dependency injection - how do I share services around?

2013-05-11 Thread Colin Yates
Yes it does, thanks. It is amazing how much you can do in the typical spring/hibernate stack with a decent IDE without engaging your brain :). Clojure involves far less ceremony and really does expose you to the raw elements of your problem domain and make you think. This is of course a good

Re: Not using dependency injection - how do I share services around?

2013-05-11 Thread Jimmy
Do any of the clojure books cover this topic? -- -- 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 Note that posts from new members are moderated - please be patient with your first post. To

Re: Not using dependency injection - how do I share services around?

2013-05-11 Thread Jimmy
Do any of the clojure books cover this topic? -- -- 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 Note that posts from new members are moderated - please be patient with your first post. To

Re: Why is using (not (empty? coll)) not idiomatic?

2013-05-11 Thread Kelker Ryan
(seq coll) will return a true value if the collection isn't empty. It will also return nil (false) if it is. 11.05.2013, 17:37, Nico Balestra nicobales...@gmail.com: I'm not sure this question has been asked already, but I really want to know the principle behind (not (empty? coll)) not being

Re: Why is using (not (empty? coll)) not idiomatic?

2013-05-11 Thread Kelker Ryan
Here's an example. user= (if (seq []) (println 1)) nil user= (if (seq [1]) (println 1)) 1 nil 11.05.2013, 18:40, Kelker Ryan (seq coll) will return a true value if the collection isn't empty. It will also return nil (false) if it is. 11.05.2013, 17:37, Nico Balestra nicobales...@gmail.com:

Re: Why is using (not (empty? coll)) not idiomatic?

2013-05-11 Thread Chris Ford
IMHO it's a bit subjective, but empty? is defined as (not (seq coll)), so using (not (empty? coll)) is really saying (not (not (seq coll))), which feels a bit backwards. Using seq also plays nicely with if-let: (if-let [foo (seq hey)] (print foo)) (if-let [foo (seq )] (print foo)) Chris On 11

Re: Not using dependency injection - how do I share services around?

2013-05-11 Thread abp
Well, you could also watch Stuart Sierras talks on structuring functional programs: Clojure in the Large http://vimeo.com/46163090 Thinking in Data Functional Design Patterns http://www.infoq.com/author/Stuart-Sierra On Saturday, May 11, 2013 10:48:02 AM UTC+2, Colin Yates wrote: Yes it

Clojure Web Framework

2013-05-11 Thread Kelker Ryan
There's now an example and a tutorial for using the CHP web framework.CHP - https://github.com/runexec/chpWork with HTML, CSS, _javascript_, and SQL using Clojure. -- -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email

[ANN] core.typed 0.1.14

2013-05-11 Thread Ambrose Bonnaire-Sergeant
Hi, Announcing a new release of core.typed, with a bunch of improvements and fixes. Leiningen: [org.clojure/core.typed 0.1.14] Highlights: - support optional mandatory function keyword arguments - def-alias takes a docstring, and adds appropriate :doc metadata to the alias var. - accumulates

Re: [ANN] core.typed 0.1.14

2013-05-11 Thread Max Penet
Hi, Some nice improvements here, thanks! - Max On Saturday, May 11, 2013 3:53:02 PM UTC+2, Ambrose Bonnaire-Sergeant wrote: Hi, Announcing a new release of core.typed, with a bunch of improvements and fixes. Leiningen: [org.clojure/core.typed 0.1.14] Highlights: - support optional

Re: [ANN] core.typed 0.1.14

2013-05-11 Thread Ambrose Bonnaire-Sergeant
Thanks! I'll be open sourcing a hobby project in the next few days that shows off these features. Ambrose On Sat, May 11, 2013 at 10:12 PM, Max Penet m...@qbits.cc wrote: Hi, Some nice improvements here, thanks! - Max On Saturday, May 11, 2013 3:53:02 PM UTC+2, Ambrose Bonnaire-Sergeant

FTP with Clojure on Heroku

2013-05-11 Thread Jonathon McKitrick
I did some googling today, and didn't find much specifically for Clojure, and most of what I did find was a bit stale. Has anyone had any success accepting FTP uploads in Clojure on Heroku? -- -- You received this message because you are subscribed to the Google Groups Clojure group. To post

Clojure performance measuring

2013-05-11 Thread Jonathon McKitrick
If I cannot get New Relic to work, I'm going to stick to my development platform for initial optimization and memory troubleshooting. What tools do you recommend for profiling memory under Clojure? I didn't have much luck with VisualVM, since my Mac is a bit dated at this point, but I'd be

Re: Why is using (not (empty? coll)) not idiomatic?

2013-05-11 Thread Karsten Schmidt
What's the idiom in (seq coll)? Maybe one could say that, generally, in Clojure it's more meaningful to work with truthy values instead of the boolean true... ? -- -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to

Re: Why is using (not (empty? coll)) not idiomatic?

2013-05-11 Thread Alex Baranosky
Most of the code I see and write at work at Runa uses (not (empty? foo)). I'll continue to defend the position that it is more obvious code, and therefore better (imo :) ) Alex On Sat, May 11, 2013 at 12:22 PM, Karsten Schmidt i...@toxi.co.uk wrote: What's the idiom in (seq coll)? Maybe

Re: Not using dependency injection - how do I share services around?

2013-05-11 Thread Colin Yates
Not specifically, nope. On 11 May 2013 10:37, Jimmy jimmy.co...@gmail.com wrote: Do any of the clojure books cover this topic? -- -- 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 Note

Re: Why is using (not (empty? coll)) not idiomatic?

2013-05-11 Thread Jonathan Fischer Friberg
On Sat, May 11, 2013 at 9:25 PM, Alex Baranosky alexander.barano...@gmail.com wrote: Most of the code I see and write at work at Runa uses (not (empty? foo)). I'll continue to defend the position that it is more obvious code, and therefore better (imo :) ) Alex Completely agree. (seq

Re: Why is using (not (empty? coll)) not idiomatic?

2013-05-11 Thread Sean Corfield
But then instead of (if (not (empty? foo)) (do-something-to foo) base-expr) you could just write (if (empty? foo) base-expr (do-something-to foo)) which maintains the idiomatic approach but is still more obvious code, yes? Sean On Sat, May 11, 2013 at 2:20 PM, Jonathan Fischer

Re: Why is using (not (empty? coll)) not idiomatic?

2013-05-11 Thread AtKaaZ
I agree On Sat, May 11, 2013 at 10:25 PM, Alex Baranosky alexander.barano...@gmail.com wrote: Most of the code I see and write at work at Runa uses (not (empty? foo)). I'll continue to defend the position that it is more obvious code, and therefore better (imo :) ) Alex On Sat, May

Re: Why is using (not (empty? coll)) not idiomatic?

2013-05-11 Thread Alex Baranosky
Sean, I'd tend to write things like that, yeah. On Sat, May 11, 2013 at 2:49 PM, AtKaaZ atk...@gmail.com wrote: I agree On Sat, May 11, 2013 at 10:25 PM, Alex Baranosky alexander.barano...@gmail.com wrote: Most of the code I see and write at work at Runa uses (not (empty? foo)). I'll

Re: Why is using (not (empty? coll)) not idiomatic?

2013-05-11 Thread Rob Lachlan
Doesn't anyone use not-empty? http://clojuredocs.org/clojure_core/clojure.core/not-empty On Saturday, May 11, 2013 1:36:57 AM UTC-7, Nico Balestra wrote: I'm not sure this question has been asked already, but I really want to know the principle behind (not (empty? coll)) not being

js-clj not working

2013-05-11 Thread nchurch
I'm trying to get a map out of a Goog events object (and also out of Domina events objects). Calling js-clj on either of these, even in the most recent version of cljs, doesn't seem to do anything; it just returns the inscrutable #[object Object] at the REPL. (It doesn't seem to produce maps

Re: Not using dependency injection - how do I share services around?

2013-05-11 Thread Jason Wolfe
Hi Colin, This is one of the reasons we created graph: https://github.com/prismatic/plumbing which is a general declarative mechanism for describing complex function compositions. There's not an awesome public example yet, but we use Graph at Prismatic to build our production services, where

Released lein-cljsbuild 0.3.1

2013-05-11 Thread Evan Mezeske
Nothing major in this release other than some bugfixes and bringing the default ClojureScript version up to date. Thanks to all contributors! Release notes: https://github.com/emezeske/lein-cljsbuild/blob/master/doc/RELEASE-NOTES.md -Evan -- -- You received this message because you are

support for annotations on method parameters

2013-05-11 Thread fmjrey
I was wondering if there was any particular reason or difficulty that would explain why annotations on method parameters are not yet supported. These are quite useful in many frameworks, e.g. parameter injection, observers, eclipse e4 event

Bug in transients: Cannot add more than 8 items to a transient map

2013-05-11 Thread Wojciech Winogrodzki
Clojure 1.5.1. I'm trying to reorder a map. The keys in the map are known beforehand and their order is undefined. So, I'm taking this map and construct a new transient map with the keys ordered as I need them: defn reorder-map [] (let [ m {:j 10 :g 7 :b 2 :d 4 :e 5 :h 8 :i 9

Re: Bug in transients: Cannot add more than 8 items to a transient map

2013-05-11 Thread Andy Fingerhut
What you are attempting to do is sometimes called bashing a transient in place. See these links for some discussion and examples: http://clojuredocs.org/clojure_core/clojure.core/assoc! http://clojuredocs.org/clojure_core/clojure.core/dissoc! Andy On Sat, May 11, 2013 at 3:51 PM,

Re: Why is using (not (empty? coll)) not idiomatic?

2013-05-11 Thread Jean Niklas L'orange
On Saturday, May 11, 2013 11:28:34 PM UTC+2, Sean Corfield wrote: you could just write [...] In some cases, this is even more readable: (if-not (empty? foo) (do-something-to foo) base-expr) which has the same effect, but in some cases, having (do-something-to foo) first may be more

Re: Bug in transients: Cannot add more than 8 items to a transient map

2013-05-11 Thread Alan Malloy
Also, maps don't have an ordering, so the function is misguided by definition. You can use a sorted-map, if having the map's keys is very important to you, but generally it's just confusion that leads to wanting this in the first place. If you do decide the map must be sorted in a specific

Re: Released lein-cljsbuild 0.3.1

2013-05-11 Thread David Nolen
Thanks! On Saturday, May 11, 2013, Evan Mezeske wrote: Nothing major in this release other than some bugfixes and bringing the default ClojureScript version up to date. Thanks to all contributors! Release notes: https://github.com/emezeske/lein-cljsbuild/blob/master/doc/RELEASE-NOTES.md