Re: Leiningen resource-paths

2014-07-24 Thread Thomas Heller
Hey,

I had this problem with a jar from Bing which is not available on maven.

You can use a local repo without any plugins or extra work for others.

Try this:

Pick a directory for your local maven repo, should be inside your git repo. 
I'm using maven.

Take your jar and run

mvn deploy:deploy-file -Dfile=lib/bing-reporting.jar 
-DartifactId=bing-reporting -Dversion=1.0.0 -DgroupId=smartchecker 
-Dpackaging=jar -Durl=file:maven

Obviously change your arguments, the important part is: -Durl=file:maven 
where maven is the directory.

Then in your project.xml

add

:repositories {local file:maven}

and depend on the jar as usual

[smartchecker/bing-reporting 1.0.0]

uberjar works as well as the rest.

Hope that helps,
/thomas


On Wednesday, July 23, 2014 12:43:38 PM UTC+2, Yura Perov wrote:

 In my project.clj I include two jar files:

 :resource-paths [resources/exterior_jars/forssj-optimization.jar 
 resources/exterior_jars/umontreal-ssj-2.5.jar]

 In my main.clj I import some objects from these dependencies:

 (ns myproject.main
   (:import [umontreal.iro.lecuyer.probdist ChiSquareDist])
   ...)

 So I am able to use them in main.clj:

 (println Hello)
 (println (. umontreal.iro.lecuyer.probdist.ChiSquareDist cdf 5 10 3.0))
 (println Bye)

 It perfectly works if I do lein run.

 However, if I do lein uberjar these dependencies are not included to the 
 standalone jar file.

 I know that there exist way to use local Maven repository, but I would 
 like to avoid this way to simplify things for anybody who wants to download 
 the source code and compile it quickly.

 Could you advise, please, is it possible to somehow force Leiningen to 
 include these two resources in the final standalone jar?

 Thank you.



-- 
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 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
--- 
You received this message because you are subscribed to the Google Groups 
Clojure group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Looking for Clojure-centric career advice/suggestions

2014-07-24 Thread VaedaStrike
I appreciate that Zach. The whole idea of casting a wider net is certainly 
something I'm open to, I may have made it appear that I'm picky when it 
comes to what I code in. I'm really not. I've gotten where I have simply 
because I've both been fortunate and driven by more unusual motives than 
what I perceive drive most programmers to get into programming. I really 
would be happy to learn just about anything that I would get paid 
sufficiently to keep my family going. It just seems a hard sell to others 
thus far.

On the open source side I both have a small side project I've thought about 
putting out there, but it would need a bit of polishing before I think I'd 
feel right about putting it out there. Maybe I need to look into that more.

Anyway, I very much appreciate you taking your time to respond to me Zach. 
The advice is very good and the emotional boost to see people respond with 
thoughtful and frank advice is very significant.

--Ethan

On Tuesday, July 22, 2014 10:55:12 PM UTC-6, Zach Oakes wrote:

 It sounds like you know what you want, and you're fortunate for that. I 
 often don't, and I can tell you that greatly complicates things. At any 
 rate, there are few things more stressful than career changes.

 Perhaps you are casting too small a net. Many here would love to be paid 
 to write Clojure, but if you can't find such an opportunity, you may want 
 to broaden your search for functional or JVM-based jobs instead.

 It is also very helpful to have some open source work you can show off. 
 Coding challenges are often completely detached from reality, and open 
 source work can sometimes offset their importance.

 Zach

 On Tuesday, July 22, 2014 9:03:13 PM UTC-4, VaedaStrike wrote:

 TL;DR - Got as close to a dream job as I could have wanted, after 6 
 months lost it. Now, with only experience in Clojure and Scala, and 
 seemingly stuck in Utah, not sure what's the best next course of action.

 I'm putting this out there because of all the good experiences I've had 
 over the years with people in the Clojure community. I very much value what 
 you all have done and do. As best I can tell you're the salt of the earth.

 I'm a rather newly minted programmer. Six months on the job.

 I claim Clojure as my first language simply because I never saw my 
 initial tryst with VB.NET and Visual Studio as being much more than 
 tinkering/not really understanding. 

 It's kind of a long and convoluted story as to how I got here, I can 
 share it if anyone's interested, but for now let's just say that my 6 years 
 of trying to learn Clojure in my spare time landed me my first official 
 programming gig ... learning Scala.

 Being a bit tied to Utah (fiscally and family-wise at the moment) this 
 seemed to be the best chance I had at starting my professional programming 
 career on as close to my terms as possible, so I took it.

 I still like Clojure better than Scala (though I've learned a lot using 
 Scala), but these last six months programming in a professional environment 
 has cemented for me that I absolutely love programming. Being able to work 
 in a code repository of functional, industry oriented code and doing real 
 stuff that made a difference, I'll just say I never thought work could be 
 so enjoyable, nor that I'd ever have the chance to work with so many smart 
 and good people. 

 Unfortunately, as an outgrowth of my newness, company politics and a 
 change in team management I was told to look for a job elsewhere. 

 I got right to work and applied to everything that looked anything close 
 to what I then had. 

 I was amazed, the first four I applied to all responded well. And as a 
 plus they all were either using, or experimenting with either Clojure or 
 Scala.

 Unfortunately, as unexpected as the job loss was for myself, it hit my 
 wife even harder, we've not had an easy time our first 4 years of marriage 
 on the economic side of things and emotionally she was rather paralyzed by 
 this news. This combined in an unfortunate way with the fact that all four 
 places quickly responded to me and, also in a difficult way, with a few 
 decisions in how to approach the coding challenges I was given. In short, I 
 was not terribly impressive for any of the four companies. Ironically the 
 one company where I felt I did the worst has been the most understanding 
 and is willing to give me a second chance after I take a couple of 
 challenges they've given me.

 The problem I'm looking for help with is to know how to approach this in 
 the best way that keeps me bringing in food for and keeping a roof over 
  the head of my wife and son, all this hopefully without sidelining my 
 career goals, to the extent that that's possible. 

 While I can't go and do a hard ruling out of anything, the whole 
 relocation idea to where jobs are would be an insanely tough sell. I'm not 
 sure if anyone would take on a remote worker as green as myself. And here, 
 where I'm at in Utah, is hardly 

Re: Looking for Clojure-centric career advice/suggestions

2014-07-24 Thread VaedaStrike
The QA thing has passed my mind, and for the same reason you mentioned, 
being able to sneak in some clojure/clojurescript into the automation.

I may need to look more into the whole contracting thing. It is a bit scary 
when I've got so little real world experience.

On Wednesday, July 23, 2014 6:47:56 PM UTC-6, Alan Moore wrote:

 Many of us started out in non-development jobs and worked our way into 
 full time coding. Tech support jobs are ok but I would focus more on QA 
 jobs. This might allow you to do some automated testing using 
 clojure/clojurescript and given that test code isn't given the scrutiny 
 that dev code goes through, you might be able to justify clojure to mgmt.

 I started out in Product Support - a role between dev and the rest of the 
 organization - these positions are usually only found in a very large tech 
 organizations with a physical product (our company invented automated 
 attendant voicemail.) As a product support engineer, I managed alpha and 
 beta trials, wrote documentation, tested features, gave feedback to 
 engineering, etc. This might be something you could try.

 A third alternative is to do contract programming/consulting. This might 
 be a harder sell but often can get you around geographical restrictions. 
 Travel might be involved...

 Good luck!

 Alan


 On Tuesday, July 22, 2014 6:03:13 PM UTC-7, VaedaStrike wrote:

 TL;DR - Got as close to a dream job as I could have wanted, after 6 
 months lost it. Now, with only experience in Clojure and Scala, and 
 seemingly stuck in Utah, not sure what's the best next course of action.

 I'm putting this out there because of all the good experiences I've had 
 over the years with people in the Clojure community. I very much value what 
 you all have done and do. As best I can tell you're the salt of the earth.

 I'm a rather newly minted programmer. Six months on the job.

 I claim Clojure as my first language simply because I never saw my 
 initial tryst with VB.NET and Visual Studio as being much more than 
 tinkering/not really understanding. 

 It's kind of a long and convoluted story as to how I got here, I can 
 share it if anyone's interested, but for now let's just say that my 6 years 
 of trying to learn Clojure in my spare time landed me my first official 
 programming gig ... learning Scala.

 Being a bit tied to Utah (fiscally and family-wise at the moment) this 
 seemed to be the best chance I had at starting my professional programming 
 career on as close to my terms as possible, so I took it.

 I still like Clojure better than Scala (though I've learned a lot using 
 Scala), but these last six months programming in a professional environment 
 has cemented for me that I absolutely love programming. Being able to work 
 in a code repository of functional, industry oriented code and doing real 
 stuff that made a difference, I'll just say I never thought work could be 
 so enjoyable, nor that I'd ever have the chance to work with so many smart 
 and good people. 

 Unfortunately, as an outgrowth of my newness, company politics and a 
 change in team management I was told to look for a job elsewhere. 

 I got right to work and applied to everything that looked anything close 
 to what I then had. 

 I was amazed, the first four I applied to all responded well. And as a 
 plus they all were either using, or experimenting with either Clojure or 
 Scala.

 Unfortunately, as unexpected as the job loss was for myself, it hit my 
 wife even harder, we've not had an easy time our first 4 years of marriage 
 on the economic side of things and emotionally she was rather paralyzed by 
 this news. This combined in an unfortunate way with the fact that all four 
 places quickly responded to me and, also in a difficult way, with a few 
 decisions in how to approach the coding challenges I was given. In short, I 
 was not terribly impressive for any of the four companies. Ironically the 
 one company where I felt I did the worst has been the most understanding 
 and is willing to give me a second chance after I take a couple of 
 challenges they've given me.

 The problem I'm looking for help with is to know how to approach this in 
 the best way that keeps me bringing in food for and keeping a roof over 
  the head of my wife and son, all this hopefully without sidelining my 
 career goals, to the extent that that's possible. 

 While I can't go and do a hard ruling out of anything, the whole 
 relocation idea to where jobs are would be an insanely tough sell. I'm not 
 sure if anyone would take on a remote worker as green as myself. And here, 
 where I'm at in Utah, is hardly full of companies ready to take some guy 
 who has 6 months of Scala experience and only self-taught (and what most 
 would consider 'hobby' experience) with Clojure. Aside from the fact that 
 very few even know what those languages are is the fact that since I've 
 been so focused on functional programming I'm really hard pressed to show 

London Clojure/ClojureScript job

2014-07-24 Thread Paul Butcher
I’m looking to recruit a senior software engineer in London to work with 
Clojure, ClojureScript, React/Reagent, Docker, and a bunch of other equally 
interesting technologies. 

We’re not necessarily looking for Clojure/ClojureScript experience, so if 
you’ve been champing at the bit to get into this kind of thing, but have been 
unable to do so in your current role, we’d definitely be interested in talking 
to you.

https://www.linkedin.com/jobs2/view/11032601

--
paul.butcher-msgCount++

Silverstone, Brands Hatch, Donington Park...
Who says I have a one track mind?

http://www.paulbutcher.com/
LinkedIn: http://www.linkedin.com/in/paulbutcher
Skype: paulrabutcher

Author of Seven Concurrency Models in Seven Weeks: When Threads Unravel
http://pragprog.com/book/pb7con

-- 
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 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
--- 
You received this message because you are subscribed to the Google Groups 
Clojure group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ClojureScript] London Clojure/ClojureScript job

2014-07-24 Thread Bruce Durling
Paul,

You might also want to post this on London Clojurians Jobs

https://groups.google.com/forum/#!forum/london-clojurian-jobs

cheers,
Bruce

On Thu, Jul 24, 2014 at 10:45 AM, Paul Butcher p...@paulbutcher.com wrote:
 I’m looking to recruit a senior software engineer in London to work with
 Clojure, ClojureScript, React/Reagent, Docker, and a bunch of other equally
 interesting technologies.

 We’re not necessarily looking for Clojure/ClojureScript experience, so if
 you’ve been champing at the bit to get into this kind of thing, but have
 been unable to do so in your current role, we’d definitely be interested in
 talking to you.

 https://www.linkedin.com/jobs2/view/11032601

 --
 paul.butcher-msgCount++

 Silverstone, Brands Hatch, Donington Park...
 Who says I have a one track mind?

 http://www.paulbutcher.com/
 LinkedIn: http://www.linkedin.com/in/paulbutcher
 Skype: paulrabutcher

 Author of Seven Concurrency Models in Seven Weeks: When Threads Unravel
 http://pragprog.com/book/pb7con

 --
 Note that posts from new members are moderated - please be patient with your
 first post.
 ---
 You received this message because you are subscribed to the Google Groups
 ClojureScript group.
 To unsubscribe from this group and stop receiving emails from it, send an
 email to clojurescript+unsubscr...@googlegroups.com.
 To post to this group, send email to clojurescr...@googlegroups.com.
 Visit this group at http://groups.google.com/group/clojurescript.



-- 
@otfrom | CTO  co-founder @MastodonC | mastodonc.com
See recent coverage of us in the Economist http://econ.st/WeTd2i and
the Financial Times http://on.ft.com/T154BA

-- 
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 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
--- 
You received this message because you are subscribed to the Google Groups 
Clojure group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ClojureScript] London Clojure/ClojureScript job

2014-07-24 Thread Paul Butcher
On 24 July 2014 at 11:32:53, Bruce Durling (b...@otfrom.com) wrote:

Paul, 

You might also want to post this on London Clojurians Jobs 

https://groups.google.com/forum/#!forum/london-clojurian-jobs 

Ah! I’ve just posted it to London Clojurians - I wasn’t aware of the separate 
jobs list (blush).

Thanks!

--
paul.butcher-msgCount++

Silverstone, Brands Hatch, Donington Park...
Who says I have a one track mind?

http://www.paulbutcher.com/
LinkedIn: http://www.linkedin.com/in/paulbutcher
Skype: paulrabutcher

Author of Seven Concurrency Models in Seven Weeks: When Threads Unravel
http://pragprog.com/book/pb7con

-- 
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 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
--- 
You received this message because you are subscribed to the Google Groups 
Clojure group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Is Korma still a good current choice for DB backend?

2014-07-24 Thread Bobby Eickhoff
Slight tangent:  I've never used honeysql, but every time I see the name I 
want it to be pronounced honeysuckle.  Is that the naming intent, or is 
it simply honey s q l?

On Tuesday, July 22, 2014 8:10:16 AM UTC-4, Jonathon McKitrick wrote:

 Development and support seem to have slowed down.  Are there newer or 
 better choices out there with momentum right now?



-- 
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 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
--- 
You received this message because you are subscribed to the Google Groups 
Clojure group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ClojureScript] London Clojure/ClojureScript job

2014-07-24 Thread Colin Fleming
Although I don't live in London, it's encouraging to see how much Clojure
work is on offer there! That's great

Cheers,
Colin


On 24 July 2014 12:40, Paul Butcher p...@paulbutcher.com wrote:

 On 24 July 2014 at 11:32:53, Bruce Durling (b...@otfrom.com) wrote:

 Paul,

 You might also want to post this on London Clojurians Jobs

 https://groups.google.com/forum/#!forum/london-clojurian-jobs


 Ah! I’ve just posted it to London Clojurians - I wasn’t aware of the
 separate jobs list (blush).

 Thanks!

  --
 paul.butcher-msgCount++

 Silverstone, Brands Hatch, Donington Park...
 Who says I have a one track mind?

 http://www.paulbutcher.com/
 LinkedIn: http://www.linkedin.com/in/paulbutcher
 Skype: paulrabutcher

 Author of Seven Concurrency Models in Seven Weeks: When Threads Unravel
 http://pragprog.com/book/pb7con

 --
 Note that posts from new members are moderated - please be patient with
 your first post.
 ---
 You received this message because you are subscribed to the Google Groups
 ClojureScript group.
 To unsubscribe from this group and stop receiving emails from it, send an
 email to clojurescript+unsubscr...@googlegroups.com.
 To post to this group, send email to clojurescr...@googlegroups.com.
 Visit this group at http://groups.google.com/group/clojurescript.


-- 
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 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
--- 
You received this message because you are subscribed to the Google Groups 
Clojure group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ClojureScript] London Clojure/ClojureScript job

2014-07-24 Thread Bruce Durling
Colin,

Where do you live? I know there are other clojure jobs in Manchester
and Bristol.

cheers,
Bruce

On Thu, Jul 24, 2014 at 11:48 AM, Colin Fleming
colin.mailingl...@gmail.com wrote:
 Although I don't live in London, it's encouraging to see how much Clojure
 work is on offer there! That's great

 Cheers,
 Colin


 On 24 July 2014 12:40, Paul Butcher p...@paulbutcher.com wrote:

 On 24 July 2014 at 11:32:53, Bruce Durling (b...@otfrom.com) wrote:

 Paul,

 You might also want to post this on London Clojurians Jobs

 https://groups.google.com/forum/#!forum/london-clojurian-jobs


 Ah! I’ve just posted it to London Clojurians - I wasn’t aware of the
 separate jobs list (blush).

 Thanks!

 --
 paul.butcher-msgCount++

 Silverstone, Brands Hatch, Donington Park...
 Who says I have a one track mind?

 http://www.paulbutcher.com/
 LinkedIn: http://www.linkedin.com/in/paulbutcher
 Skype: paulrabutcher

 Author of Seven Concurrency Models in Seven Weeks: When Threads Unravel
 http://pragprog.com/book/pb7con

 --
 Note that posts from new members are moderated - please be patient with
 your first post.
 ---
 You received this message because you are subscribed to the Google Groups
 ClojureScript group.
 To unsubscribe from this group and stop receiving emails from it, send an
 email to clojurescript+unsubscr...@googlegroups.com.
 To post to this group, send email to clojurescr...@googlegroups.com.
 Visit this group at http://groups.google.com/group/clojurescript.





-- 
@otfrom | CTO  co-founder @MastodonC | mastodonc.com
See recent coverage of us in the Economist http://econ.st/WeTd2i and
the Financial Times http://on.ft.com/T154BA

-- 
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 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
--- 
You received this message because you are subscribed to the Google Groups 
Clojure group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Is Korma still a good current choice for DB backend?

2014-07-24 Thread Paul Butcher
I wasn’t aware of yesql - thanks for the pointer.

My concern with “write your queries in pure SQL” is increased vulnerability to 
SQL injection. From a quick glance at yesql, it seems likely that it does 
provide protection against SQL injection, but there’s nothing in the 
documentation (that I can find at first glance, at least) that explicitly says 
so.

Can anyone who understands it confirm or deny?

--
paul.butcher-msgCount++

Silverstone, Brands Hatch, Donington Park...
Who says I have a one track mind?

http://www.paulbutcher.com/
LinkedIn: http://www.linkedin.com/in/paulbutcher
Skype: paulrabutcher

Author of Seven Concurrency Models in Seven Weeks: When Threads Unravel
http://pragprog.com/book/pb7con

On 22 July 2014 at 14:08:20, Timothy Baldridge (tbaldri...@gmail.com) wrote:

Also, read the rationale behint yesql: https://github.com/krisajenkins/yesql 
IMO, it hits the nail on the head. ORMs are both crappy object systems and 
crappy DB DSLs. With a library like yesql you write your queries in pure SQL 
and get pure data back. Now you can fully leverage both SQL and Clojure. 

Timothy


On Tue, Jul 22, 2014 at 6:45 AM, Jonathon McKitrick jmckitr...@gmail.com 
wrote:
I'll keep that in mind when I decide to learn MongoDB.  :-)


On Tuesday, July 22, 2014 8:25:16 AM UTC-4, Robin Heggelund Hansen wrote:
Don't know about SQL-based solutions, but Monger (MongoDB bindings) just 
released a 2.0 update and is great!

kl. 14:10:16 UTC+2 tirsdag 22. juli 2014 skrev Jonathon McKitrick følgende:
Development and support seem to have slowed down.  Are there newer or better 
choices out there with momentum right now?

--
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 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
---
You received this message because you are subscribed to the Google Groups 
Clojure group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
“One of the main causes of the fall of the Roman Empire was that–lacking 
zero–they had no way to indicate successful termination of their C programs.”
(Robert Firth)
--
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 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
---
You received this message because you are subscribed to the Google Groups 
Clojure group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

-- 
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 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
--- 
You received this message because you are subscribed to the Google Groups 
Clojure group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Is Korma still a good current choice for DB backend?

2014-07-24 Thread Jony Hudson

It passes the queries through clojure.java.jdbc, so provides the same level 
of protection as that, as far as I am aware.


Jony


On Thursday, 24 July 2014 12:08:52 UTC+1, Paul Butcher wrote:

 I wasn’t aware of yesql - thanks for the pointer.

 My concern with “write your queries in pure SQL” is increased 
 vulnerability to SQL injection. From a quick glance at yesql, it seems 
 likely that it does provide protection against SQL injection, but there’s 
 nothing in the documentation (that I can find at first glance, at least) 
 that explicitly says so.

 Can anyone who understands it confirm or deny?


-- 
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 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
--- 
You received this message because you are subscribed to the Google Groups 
Clojure group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Is Korma still a good current choice for DB backend?

2014-07-24 Thread Jony Hudson
Pressed send to eagerly! Relevant 
code: https://github.com/krisajenkins/yesql/blob/master/src/yesql/types.clj


Jony

On Thursday, 24 July 2014 12:58:27 UTC+1, Jony Hudson wrote:


 It passes the queries through clojure.java.jdbc, so provides the same 
 level of protection as that, as far as I am aware.


 Jony


 On Thursday, 24 July 2014 12:08:52 UTC+1, Paul Butcher wrote:

 I wasn’t aware of yesql - thanks for the pointer.

 My concern with “write your queries in pure SQL” is increased 
 vulnerability to SQL injection. From a quick glance at yesql, it seems 
 likely that it does provide protection against SQL injection, but there’s 
 nothing in the documentation (that I can find at first glance, at least) 
 that explicitly says so.

 Can anyone who understands it confirm or deny?



-- 
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 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
--- 
You received this message because you are subscribed to the Google Groups 
Clojure group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: clojure.stacktrace/root-cause VS clojure.repl/root-cause, are they redundant?

2014-07-24 Thread Stuart Sierra
They're just different versions of the same thing, written at different 
times by different people, that both got merged into Clojure at different 
times.

Speaking as the original author of clojure.stacktrace, I now think neither 
one of them should exist. The .printStackTrace method on an exception gives 
you all the same information and is more reliable.

-S


On Monday, July 21, 2014 7:30:17 AM UTC-4, Pierre Masci wrote:

 Hi, I'm learning about tools to help me debug from the REPL, and I found 
 these two with the same name:

 clojure.stacktrace/root-cause

 clojure.repl/root-cause


-- 
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 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
--- 
You received this message because you are subscribed to the Google Groups 
Clojure group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ClojureScript] London Clojure/ClojureScript job

2014-07-24 Thread Colin Fleming
I live in New Zealand - the commute is a little long :-). But it's
generally encouraging to see an active Clojure job market anywhere.

Cheers,
Colin


On 24 July 2014 12:49, Bruce Durling b...@otfrom.com wrote:

 Colin,

 Where do you live? I know there are other clojure jobs in Manchester
 and Bristol.

 cheers,
 Bruce

 On Thu, Jul 24, 2014 at 11:48 AM, Colin Fleming
 colin.mailingl...@gmail.com wrote:
  Although I don't live in London, it's encouraging to see how much Clojure
  work is on offer there! That's great
 
  Cheers,
  Colin
 
 
  On 24 July 2014 12:40, Paul Butcher p...@paulbutcher.com wrote:
 
  On 24 July 2014 at 11:32:53, Bruce Durling (b...@otfrom.com) wrote:
 
  Paul,
 
  You might also want to post this on London Clojurians Jobs
 
  https://groups.google.com/forum/#!forum/london-clojurian-jobs
 
 
  Ah! I’ve just posted it to London Clojurians - I wasn’t aware of the
  separate jobs list (blush).
 
  Thanks!
 
  --
  paul.butcher-msgCount++
 
  Silverstone, Brands Hatch, Donington Park...
  Who says I have a one track mind?
 
  http://www.paulbutcher.com/
  LinkedIn: http://www.linkedin.com/in/paulbutcher
  Skype: paulrabutcher
 
  Author of Seven Concurrency Models in Seven Weeks: When Threads Unravel
  http://pragprog.com/book/pb7con
 
  --
  Note that posts from new members are moderated - please be patient with
  your first post.
  ---
  You received this message because you are subscribed to the Google
 Groups
  ClojureScript group.
  To unsubscribe from this group and stop receiving emails from it, send
 an
  email to clojurescript+unsubscr...@googlegroups.com.
  To post to this group, send email to clojurescr...@googlegroups.com.
  Visit this group at http://groups.google.com/group/clojurescript.
 
 



 --
 @otfrom | CTO  co-founder @MastodonC | mastodonc.com
 See recent coverage of us in the Economist http://econ.st/WeTd2i and
 the Financial Times http://on.ft.com/T154BA


-- 
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 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
--- 
You received this message because you are subscribed to the Google Groups 
Clojure group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Leiningen resource-paths

2014-07-24 Thread Yura Perov
Dear Thomas Heller,

Thank you very much for your reply.

As I mentioned in my initial post (sorry, it was a bit long), I 
successfully managed local Maven repository to work with Leiningen:

 I know that there exist way to use local Maven repository, but I would 
 like to avoid this way to simplify things for anybody who wants to download 
 the source code and compile it quickly.


However, local Maven is an additional issue developers should care about, 
and I am trying to find a way to avoid using it at least for exterior jars 
I am sure we do not need to update or care about their versions.

I am trying to understand how does Leiningen process :resource-paths 
directive and if there is a way to force classes from exterior jars be 
included in the producing standalone jar.

Yours faithfully,
Yura

On Thursday, July 24, 2014 9:18:51 AM UTC+1, Thomas Heller wrote:

 Hey,

 I had this problem with a jar from Bing which is not available on maven.

 You can use a local repo without any plugins or extra work for others.

 Try this:

 Pick a directory for your local maven repo, should be inside your git 
 repo. I'm using maven.

 Take your jar and run

 mvn deploy:deploy-file -Dfile=lib/bing-reporting.jar 
 -DartifactId=bing-reporting -Dversion=1.0.0 -DgroupId=smartchecker 
 -Dpackaging=jar -Durl=file:maven

 Obviously change your arguments, the important part is: -Durl=file:maven 
 where maven is the directory.

 Then in your project.xml

 add

 :repositories {local file:maven}

 and depend on the jar as usual

 [smartchecker/bing-reporting 1.0.0]

 uberjar works as well as the rest.

 Hope that helps,
 /thomas


 On Wednesday, July 23, 2014 12:43:38 PM UTC+2, Yura Perov wrote:

 In my project.clj I include two jar files:

 :resource-paths [resources/exterior_jars/forssj-optimization.jar 
 resources/exterior_jars/umontreal-ssj-2.5.jar]

 In my main.clj I import some objects from these dependencies:

 (ns myproject.main
   (:import [umontreal.iro.lecuyer.probdist ChiSquareDist])
   ...)

 So I am able to use them in main.clj:

 (println Hello)
 (println (. umontreal.iro.lecuyer.probdist.ChiSquareDist cdf 5 10 3.0))
 (println Bye)

 It perfectly works if I do lein run.

 However, if I do lein uberjar these dependencies are not included to the 
 standalone jar file.

 I know that there exist way to use local Maven repository, but I would 
 like to avoid this way to simplify things for anybody who wants to download 
 the source code and compile it quickly.

 Could you advise, please, is it possible to somehow force Leiningen to 
 include these two resources in the final standalone jar?

 Thank you.



-- 
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 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
--- 
You received this message because you are subscribed to the Google Groups 
Clojure group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Leiningen resource-paths

2014-07-24 Thread Thomas Heller
I don't quite understand the issue against using the way I described.

Assuming you keep everything in a git repo (inclucing that maven 
directory), only you have to execute the mvn command ONCE, all it does it 
put the file into the correct directory and generate the needed metadata 
files. After that users of your code just check out everything and run lein 
like normal. No extra maven commands to run or setup. IMHO its just the 
same as depending on the jar via :resource-paths. As I understand it there 
are other ways to setup local Maven depositories, maybe you tried it a 
different way which may require more steps. IIRC its mvn deploy:deploy-file 
vs install-file or something, can't remember exactly.

As for :resource-paths and how leiningen handles them: they are just 
appended to the classpath, thats about it. uberjar doesn't identify jars in 
there so just copies them INSIDE the uberjar so you'll have jar in a jar 
which java doesnt understand.

/thomas

On Thursday, July 24, 2014 3:22:37 PM UTC+2, Yura Perov wrote:

 Dear Thomas Heller,

 Thank you very much for your reply.

 As I mentioned in my initial post (sorry, it was a bit long), I 
 successfully managed local Maven repository to work with Leiningen:

 I know that there exist way to use local Maven repository, but I would 
 like to avoid this way to simplify things for anybody who wants to download 
 the source code and compile it quickly.


 However, local Maven is an additional issue developers should care about, 
 and I am trying to find a way to avoid using it at least for exterior jars 
 I am sure we do not need to update or care about their versions.

 I am trying to understand how does Leiningen process :resource-paths 
 directive and if there is a way to force classes from exterior jars be 
 included in the producing standalone jar.

 Yours faithfully,
 Yura

 On Thursday, July 24, 2014 9:18:51 AM UTC+1, Thomas Heller wrote:

 Hey,

 I had this problem with a jar from Bing which is not available on maven.

 You can use a local repo without any plugins or extra work for others.

 Try this:

 Pick a directory for your local maven repo, should be inside your git 
 repo. I'm using maven.

 Take your jar and run

 mvn deploy:deploy-file -Dfile=lib/bing-reporting.jar 
 -DartifactId=bing-reporting -Dversion=1.0.0 -DgroupId=smartchecker 
 -Dpackaging=jar -Durl=file:maven

 Obviously change your arguments, the important part is: -Durl=file:maven 
 where maven is the directory.

 Then in your project.xml

 add

 :repositories {local file:maven}

 and depend on the jar as usual

 [smartchecker/bing-reporting 1.0.0]

 uberjar works as well as the rest.

 Hope that helps,
 /thomas


 On Wednesday, July 23, 2014 12:43:38 PM UTC+2, Yura Perov wrote:

 In my project.clj I include two jar files:

 :resource-paths [resources/exterior_jars/forssj-optimization.jar 
 resources/exterior_jars/umontreal-ssj-2.5.jar]

 In my main.clj I import some objects from these dependencies:

 (ns myproject.main
   (:import [umontreal.iro.lecuyer.probdist ChiSquareDist])
   ...)

 So I am able to use them in main.clj:

 (println Hello)
 (println (. umontreal.iro.lecuyer.probdist.ChiSquareDist cdf 5 10 3.0))
 (println Bye)

 It perfectly works if I do lein run.

 However, if I do lein uberjar these dependencies are not included to 
 the standalone jar file.

 I know that there exist way to use local Maven repository, but I would 
 like to avoid this way to simplify things for anybody who wants to download 
 the source code and compile it quickly.

 Could you advise, please, is it possible to somehow force Leiningen to 
 include these two resources in the final standalone jar?

 Thank you.



-- 
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 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
--- 
You received this message because you are subscribed to the Google Groups 
Clojure group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: clojure.stacktrace/root-cause VS clojure.repl/root-cause, are they redundant?

2014-07-24 Thread mascip
Thank you Stuart, this is a very useful answer.

Is there any way to access an exception older than *e?
What happens to me regularly is to mistype (.printStackTrace *e), which
makes me lost my previous exception.

-- Pierre Masci


On 24 July 2014 13:33, Stuart Sierra the.stuart.sie...@gmail.com wrote:

 They're just different versions of the same thing, written at different
 times by different people, that both got merged into Clojure at different
 times.

 Speaking as the original author of clojure.stacktrace, I now think neither
 one of them should exist. The .printStackTrace method on an exception gives
 you all the same information and is more reliable.

 -S



 On Monday, July 21, 2014 7:30:17 AM UTC-4, Pierre Masci wrote:

 Hi, I'm learning about tools to help me debug from the REPL, and I found
 these two with the same name:

 clojure.stacktrace/root-cause

 clojure.repl/root-cause

  --
 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 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
 ---
 You received this message because you are subscribed to a topic in the
 Google Groups Clojure group.
 To unsubscribe from this topic, visit
 https://groups.google.com/d/topic/clojure/Ic-49W9ZEac/unsubscribe.
 To unsubscribe from this group and all its topics, send an email to
 clojure+unsubscr...@googlegroups.com.
 For more options, visit https://groups.google.com/d/optout.


-- 
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 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
--- 
You received this message because you are subscribed to the Google Groups 
Clojure group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: clojure.stacktrace/root-cause VS clojure.repl/root-cause, are they redundant?

2014-07-24 Thread Andy Fingerhut
I know of no way that older exceptions than *e are automatically saved
anywhere (unlike the results of previous REPL expressions, of which the
last 3 are saved in *1 *2 *3).

When an exception occurs, it is probably much less error-prone to type a
short expression like (def e1 *e) to save the exception in e1, even if
another exception occurs after that which modifies *e.

Andy


On Thu, Jul 24, 2014 at 6:46 AM, mascip mas...@gmail.com wrote:

 Thank you Stuart, this is a very useful answer.

 Is there any way to access an exception older than *e?
 What happens to me regularly is to mistype (.printStackTrace *e), which
 makes me lost my previous exception.

 -- Pierre Masci


 On 24 July 2014 13:33, Stuart Sierra the.stuart.sie...@gmail.com wrote:

 They're just different versions of the same thing, written at different
 times by different people, that both got merged into Clojure at different
 times.

 Speaking as the original author of clojure.stacktrace, I now think
 neither one of them should exist. The .printStackTrace method on an
 exception gives you all the same information and is more reliable.

 -S



 On Monday, July 21, 2014 7:30:17 AM UTC-4, Pierre Masci wrote:

 Hi, I'm learning about tools to help me debug from the REPL, and I found
 these two with the same name:

 clojure.stacktrace/root-cause

 clojure.repl/root-cause

  --
 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 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
 ---
 You received this message because you are subscribed to a topic in the
 Google Groups Clojure group.
 To unsubscribe from this topic, visit
 https://groups.google.com/d/topic/clojure/Ic-49W9ZEac/unsubscribe.
 To unsubscribe from this group and all its topics, send an email to
 clojure+unsubscr...@googlegroups.com.

 For more options, visit https://groups.google.com/d/optout.


  --
 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 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
 ---
 You received this message because you are subscribed to the Google Groups
 Clojure group.
 To unsubscribe from this group and stop receiving emails from it, send an
 email to clojure+unsubscr...@googlegroups.com.
 For more options, visit https://groups.google.com/d/optout.


-- 
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 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
--- 
You received this message because you are subscribed to the Google Groups 
Clojure group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Leiningen resource-paths

2014-07-24 Thread Laurent PETIT
My suggestion then: instead of storing the jar files, unzip them in their
respective resource directories? Should solve the über jar problem if
Leiningen isn't too strict in filtering what's copied from resources
folders to final build dir.

Le mercredi 23 juillet 2014, Yura Perov alfu...@gmail.com a écrit :

 In my project.clj I include two jar files:

 :resource-paths [resources/exterior_jars/forssj-optimization.jar
 resources/exterior_jars/umontreal-ssj-2.5.jar]

 In my main.clj I import some objects from these dependencies:

 (ns myproject.main
   (:import [umontreal.iro.lecuyer.probdist ChiSquareDist])
   ...)

 So I am able to use them in main.clj:

 (println Hello)
 (println (. umontreal.iro.lecuyer.probdist.ChiSquareDist cdf 5 10 3.0))
 (println Bye)

 It perfectly works if I do lein run.

 However, if I do lein uberjar these dependencies are not included to the
 standalone jar file.

 I know that there exist way to use local Maven repository, but I would
 like to avoid this way to simplify things for anybody who wants to download
 the source code and compile it quickly.

 Could you advise, please, is it possible to somehow force Leiningen to
 include these two resources in the final standalone jar?

 Thank you.

  --
 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
 javascript:_e(%7B%7D,'cvml','clojure@googlegroups.com');
 Note that posts from new members are moderated - please be patient with
 your first post.
 To unsubscribe from this group, send email to
 clojure+unsubscr...@googlegroups.com
 javascript:_e(%7B%7D,'cvml','clojure%2bunsubscr...@googlegroups.com');
 For more options, visit this group at
 http://groups.google.com/group/clojure?hl=en
 ---
 You received this message because you are subscribed to the Google Groups
 Clojure group.
 To unsubscribe from this group and stop receiving emails from it, send an
 email to clojure+unsubscr...@googlegroups.com
 javascript:_e(%7B%7D,'cvml','clojure%2bunsubscr...@googlegroups.com');.
 For more options, visit https://groups.google.com/d/optout.


-- 
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 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
--- 
You received this message because you are subscribed to the Google Groups 
Clojure group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: timbre logging, java libs

2014-07-24 Thread Sean Corfield
On Jul 23, 2014, at 7:11 PM, Jonah Benton jo...@jonah.com wrote:
 Sean Corfield has a great example of writing a log4j logging backend in 
 clojure:
 
 http://corfield.org/blog/post.cfm/real-world-clojure-logging

Thanx for the referral. That made me go back and look at what that code has 
evolved into today... Despite the copyright date, we haven't actually touched 
this code for well over a year now!

One thing we decided to do was move just the dbappender.clj to a separate file 
and AOT that, minimizing the code that the compiler might transitively drag in. 
Then we lein install the logging appender and depend on it from our main 
project.

The delay / require / resolve construct seems a bit of a nasty hack so feedback 
on how to achieve that more elegantly is welcome.

We also isolated the hooks into that main project as two logging calls: one 
which writes structured data to MongoDB and one which writes flat data to MySQL:

;; copyright (c) 2012-2014 world singles llc
;;
;; custom log appender that writes (non-DEBUG) log data to the log table

(ns worldsingles.logging.dbappender
  (:import org.apache.log4j.Level
   org.apache.log4j.spi.LoggingEvent)
  (:gen-class :name worldsingles.logging.DBLogger
  :extends org.apache.log4j.AppenderSkeleton))

(def ^:private resolve-log-structured-data
  Dynamically resolve worldsingles.logging.core/log-structured-data.
   We use delay to ensure we only require / resolve once.
  (delay
   (do
 (require 'worldsingles.logging.core)
 (resolve (symbol worldsingles.logging.core/log-structured-data)

(def ^:private resolve-log-table-data
  Dynamically resolve worldsingles.logging.core/log-table-data.
   We use delay to ensure we only require / resolve once.
  (delay
   (do
 (require 'worldsingles.logging.core)
 (resolve (symbol worldsingles.logging.core/log-table-data)

;; implement void AppenderSkeleton.append(LoggingEvent event)
(defn -append
  Append non-DEBUG events to MySQL and/or MongoDB as appropriate.
  [_ ^LoggingEvent event]
  (when (.isGreaterOrEqual (.getLevel event) Level/INFO) 
(let [msg (.getMessage event)]
  (@resolve-log-structured-data msg)
  (when (and (map? msg) (= (:logtype msg) action))
(@resolve-log-table-data msg)

;; implement void Appender.close()
(defn -close [_])

;; implement boolean Appender.requiresLayout()
(defn -requiresLayout [_] false)

Sean Corfield -- (904) 302-SEAN
An Architect's View -- http://corfield.org/

Perfection is the enemy of the good.
-- Gustave Flaubert, French realist novelist (1821-1880)





signature.asc
Description: Message signed with OpenPGP using GPGMail


ANN qarth 0.1.0, an OAuth library

2014-07-24 Thread Mike Thvedt
Qarth is a simple interface to OAuth. Qarth's goal is to fix the problem of 
Ring/Compojure and/or Friend apps reinventing the wheel for OAuth.

Qarth features zero-effort Friend integration. The interactive auth flow in 
friendless Qarth is two or three lines of code plus configuration. All 
OAuth providers use the same interface, so that you can swap providers or 
use multi providers (i.e. login with Facebook or Github) with little 
additional effort.

Qarth comes with out-of-the-box support for Facebook, Github, Twitter, 
Google, and Yahoo!, and generic support for OAuth v2 and Scribe-Java.

https://github.com/mthvedt/qarth

Qarth is brand new, so please let me know about any issues or rough edges 
you encounter.

--Mike
mike.thv...@gmail.com

-- 
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 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
--- 
You received this message because you are subscribed to the Google Groups 
Clojure group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Is Korma still a good current choice for DB backend?

2014-07-24 Thread Sean Corfield
On Jul 23, 2014, at 6:34 PM, Brandon Bloom brandon.d.bl...@gmail.com wrote:
 SELECT ... main query stuff WHERE basic conditions
 AND (? OR dateUpdated = ? AND dateUpdated  ?
 AND (? OR someColumn = ?)
 ...
 (query db basic params (boolean date-range) (or date-range (now)) (or 
 date-range (now)) (boolean qualifier) (or qualifier ))

I think you mean (not date-range) and (not qualifier)? Otherwise you'll have 
(true OR ...) if the params are present... But that's a very neat trick!

I ran it past our DBA and he verified that the execution plan definitely 
short-circuits the booleans with true / false (which was my initial concern 
after being somewhat gunshy of 'OR' in queries due to performance problems that 
has caused in complex queries).

Thank you Brandon!

Sean Corfield -- (904) 302-SEAN
An Architect's View -- http://corfield.org/

Perfection is the enemy of the good.
-- Gustave Flaubert, French realist novelist (1821-1880)





signature.asc
Description: Message signed with OpenPGP using GPGMail


Re: Is Korma still a good current choice for DB backend?

2014-07-24 Thread Brandon Bloom

 I think you mean (not date-range) and (not qualifier)? Otherwise you'll
 have (true OR ...) if the params are present... But that's a very neat
 trick!


Ah, yes, that's of course what I meant. Was wasting mental cycles on
parameter ordering... Use named parameters people!


 I ran it past our DBA and he verified that the execution plan definitely
 short-circuits the booleans with true / false (which was my initial concern
 after being somewhat gunshy of 'OR' in queries due to performance problems
 that has caused in complex queries).


You should also verify the `date  LEAST(NULL, MAX(date))` approach too. I
suspect that the query planner will summarily eliminate the aggregate.

-- 
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 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
--- 
You received this message because you are subscribed to the Google Groups 
Clojure group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


More Clojure XML challenges

2014-07-24 Thread Adrian O'Sullivan
I'm really struggling to understand how to parse XML in Clojure.

Here's my xml:

javancss
   function
  namejava.complexity.HelloWorld.notcomplex()/name
  ncss2/ncss
  ccn1/ccn
  javadocs0/javadocs
/function
function
  namejava.complexity.HelloWorld.complex(int)/name
  ncss4/ncss
  ccn2/ccn
  javadocs0/javadocs
/function 
... etc

I can do (xml-seq (xml/parse .. )) on this, or ( zip/xml-zip  (xml/parse 
... ), I don't mind which.

My task is to extract all the function elements where the ncss value  3, 
then sum the ccn values of the remaining elements.  I simply cannot figure 
out how to do this.  All I can do is extract text of particular elements, 
e.g. 

(apply + (map read-string (zf/xml- ncss-zip :functions :function :ccn 
 zf/text)))

If anyone can help out, it would be much appreciated.

-- 
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 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
--- 
You received this message because you are subscribed to the Google Groups 
Clojure group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Is this behavior with recur and pre/post a bug?

2014-07-24 Thread Michael O'Keefe
Hello All,

I encountered the following behavior in Clojure 1.6 and wanted to check if 
it should be considered a bug or not. I would say yes but wanted to double 
check on the list first.

Here's a minimal test case that elicited the error:

(defn f

  [xs acc]
  (if (nil? xs)
acc
(recur (next xs) (+ (first xs) acc

(f [1 2 3 4] 0) = 10


Now, if I want to add pre/post conditions, the following happens: 

(defn g 

  [xs acc]
  {:pre [(or (nil? xs) (sequential? xs)) (number? acc)]
   :post [number?]}
  (if (nil? xs)
acc
(recur (next xs) (+ (first xs) acc


= this fails to compile with CompilerException 
java.lang.UnsupportedOperationException: Can only recur from tail position


In fact, it is only the post-condition that triggers the issue.

My guess would be that the recur statement is being knocked out of tail 
position by the mechanism for handling the post-condition assertion. It can 
be fixed in the code by adding an explicit loop:

(defn g2 [xs acc]
  {:pre [(or (nil? xs) (sequential? xs)) (number? acc)]
   :post [number?]}
  (loop [xs xs
 acc acc]
(if (nil? xs)
  acc
  (recur (next xs) (+ (first xs) acc)

 
Thanks,

Michael O'Keefe

-- 
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 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
--- 
You received this message because you are subscribed to the Google Groups 
Clojure group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: clojure.stacktrace/root-cause VS clojure.repl/root-cause, are they redundant?

2014-07-24 Thread mascip
Saving *e in a def for further investigation, handy :) Cheers
On 24 Jul 2014 15:48, Andy Fingerhut andy.finger...@gmail.com wrote:

 I know of no way that older exceptions than *e are automatically saved
 anywhere (unlike the results of previous REPL expressions, of which the
 last 3 are saved in *1 *2 *3).

 When an exception occurs, it is probably much less error-prone to type a
 short expression like (def e1 *e) to save the exception in e1, even if
 another exception occurs after that which modifies *e.

 Andy


 On Thu, Jul 24, 2014 at 6:46 AM, mascip mas...@gmail.com wrote:

 Thank you Stuart, this is a very useful answer.

 Is there any way to access an exception older than *e?
 What happens to me regularly is to mistype (.printStackTrace *e), which
 makes me lost my previous exception.

 -- Pierre Masci


 On 24 July 2014 13:33, Stuart Sierra the.stuart.sie...@gmail.com wrote:

 They're just different versions of the same thing, written at different
 times by different people, that both got merged into Clojure at different
 times.

 Speaking as the original author of clojure.stacktrace, I now think
 neither one of them should exist. The .printStackTrace method on an
 exception gives you all the same information and is more reliable.

 -S



 On Monday, July 21, 2014 7:30:17 AM UTC-4, Pierre Masci wrote:

 Hi, I'm learning about tools to help me debug from the REPL, and I
 found these two with the same name:

 clojure.stacktrace/root-cause

 clojure.repl/root-cause

  --
 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 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
 ---
 You received this message because you are subscribed to a topic in the
 Google Groups Clojure group.
 To unsubscribe from this topic, visit
 https://groups.google.com/d/topic/clojure/Ic-49W9ZEac/unsubscribe.
 To unsubscribe from this group and all its topics, send an email to
 clojure+unsubscr...@googlegroups.com.

 For more options, visit https://groups.google.com/d/optout.


  --
 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 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
 ---
 You received this message because you are subscribed to the Google Groups
 Clojure group.
 To unsubscribe from this group and stop receiving emails from it, send an
 email to clojure+unsubscr...@googlegroups.com.
 For more options, visit https://groups.google.com/d/optout.


  --
 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 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
 ---
 You received this message because you are subscribed to a topic in the
 Google Groups Clojure group.
 To unsubscribe from this topic, visit
 https://groups.google.com/d/topic/clojure/Ic-49W9ZEac/unsubscribe.
 To unsubscribe from this group and all its topics, send an email to
 clojure+unsubscr...@googlegroups.com.
 For more options, visit https://groups.google.com/d/optout.


-- 
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 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
--- 
You received this message because you are subscribed to the Google Groups 
Clojure group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: More Clojure XML challenges

2014-07-24 Thread Stan Dyck


On 07/24/2014 02:45 PM, Adrian O'Sullivan wrote:

I'm really struggling to understand how to parse XML in Clojure.

Here's my xml:

javancss
   function
namejava.complexity.HelloWorld.notcomplex()/name
  ncss2/ncss
  ccn1/ccn
  javadocs0/javadocs
/function
function
namejava.complexity.HelloWorld.complex(int)/name
  ncss4/ncss
  ccn2/ccn
  javadocs0/javadocs
/function
... etc

I can do (xml-seq (xml/parse .. )) on this, or ( zip/xml-zip 
 (xml/parse ... ), I don't mind which.


My task is to extract all the function elements where the ncss value  
3, then sum the ccn values of the remaining elements.  I simply cannot 
figure out how to do this.  All I can do is extract text of particular 
elements, e.g.


(apply + (map read-string (zf/xml- ncss-zip :functions :function :ccn 
 zf/text)))


If anyone can help out, it would be much appreciated.
--


Parsing XML without using XPath is (IMHO) a fool's errand...

Use the excellent clojure saxon library https://github.com/pjt/saxon  
[clojure-saxon 0.9.4]


(require '[saxon :as sax])

(def xml (sax/compile-xml javancss
   function
namejava.complexity.HelloWorld.notcomplex()/name
  ncss2/ncss
  ccn1/ccn
  javadocs0/javadocs
/function
function
namejava.complexity.HelloWorld.complex(int)/name
  ncss4/ncss
  ccn2/ccn
  javadocs0/javadocs
/function ...))

(def sum-ncss (sax/compile-xquery sum(//function[ncss=3]/ncss)))  
;;creates a function


(sum-ncss xml)

will return what you're looking for.

Hope this helps,

StanD.

--
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 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
--- 
You received this message because you are subscribed to the Google Groups Clojure group.

To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Is this behavior with recur and pre/post a bug?

2014-07-24 Thread adrian . medina
Indeed this is the case and no; I would not consider it a bug. Because you 
have specified a post condition on the return value, the clojure.core/fn 
macro is macroexpanding properly to support that post condition. By 
recursively macroexpanding the form, you can see the what the form will 
eventually look like to the 
compiler: https://gist.github.com/aamedina/49b4f8caf28c8b78c26b 

If you're using CIDER with Emacs, you can do this on any form by invoking 
M-x cider-macroexpand-all. 

Special forms, like recur, are handled by the compiler as special cases. 
The semantics of Clojure's recur special form forbid it from being used 
anywhere but the tail position of the body of either a fn* or loop*. As you 
can see from the gist, the return value is validated by the number? 
predicate before returning, or else it throws an error.

On Thursday, July 24, 2014 6:56:22 PM UTC-4, Michael O'Keefe wrote:

 Hello All,

 I encountered the following behavior in Clojure 1.6 and wanted to check if 
 it should be considered a bug or not. I would say yes but wanted to double 
 check on the list first.

 Here's a minimal test case that elicited the error:

 (defn f

   [xs acc]
   (if (nil? xs)
 acc
 (recur (next xs) (+ (first xs) acc

 (f [1 2 3 4] 0) = 10


 Now, if I want to add pre/post conditions, the following happens: 

 (defn g 

   [xs acc]
   {:pre [(or (nil? xs) (sequential? xs)) (number? acc)]
:post [number?]}
   (if (nil? xs)
 acc
 (recur (next xs) (+ (first xs) acc


 = this fails to compile with CompilerException 
 java.lang.UnsupportedOperationException: Can only recur from tail position


 In fact, it is only the post-condition that triggers the issue.

 My guess would be that the recur statement is being knocked out of tail 
 position by the mechanism for handling the post-condition assertion. It can 
 be fixed in the code by adding an explicit loop:

 (defn g2 [xs acc]
   {:pre [(or (nil? xs) (sequential? xs)) (number? acc)]
:post [number?]}
   (loop [xs xs
  acc acc]
 (if (nil? xs)
   acc
   (recur (next xs) (+ (first xs) acc)

  
 Thanks,

 Michael O'Keefe


-- 
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 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
--- 
You received this message because you are subscribed to the Google Groups 
Clojure group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Is this behavior with recur and pre/post a bug?

2014-07-24 Thread Andy Fingerhut
I do not know whether it is considered a bug or not, but it is definitely
caused by the postcondition handling causing the recur to be knocked out of
tail position.  Here is a reference to the code:

https://github.com/clojure/clojure/blob/master/src/clj/clojure/core.clj#L4185-L4192

Andy


On Thu, Jul 24, 2014 at 3:56 PM, Michael O'Keefe michael.p.oke...@gmail.com
 wrote:

 Hello All,

 I encountered the following behavior in Clojure 1.6 and wanted to check if
 it should be considered a bug or not. I would say yes but wanted to double
 check on the list first.

 Here's a minimal test case that elicited the error:

 (defn f

   [xs acc]
   (if (nil? xs)
 acc
 (recur (next xs) (+ (first xs) acc

 (f [1 2 3 4] 0) = 10


 Now, if I want to add pre/post conditions, the following happens:

 (defn g

   [xs acc]
   {:pre [(or (nil? xs) (sequential? xs)) (number? acc)]
:post [number?]}
   (if (nil? xs)
 acc
 (recur (next xs) (+ (first xs) acc


 = this fails to compile with CompilerException
 java.lang.UnsupportedOperationException: Can only recur from tail position


 In fact, it is only the post-condition that triggers the issue.

 My guess would be that the recur statement is being knocked out of tail
 position by the mechanism for handling the post-condition assertion. It can
 be fixed in the code by adding an explicit loop:

 (defn g2 [xs acc]
   {:pre [(or (nil? xs) (sequential? xs)) (number? acc)]
:post [number?]}
   (loop [xs xs
  acc acc]
 (if (nil? xs)
   acc
   (recur (next xs) (+ (first xs) acc)


 Thanks,

 Michael O'Keefe

 --
 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 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
 ---
 You received this message because you are subscribed to the Google Groups
 Clojure group.
 To unsubscribe from this group and stop receiving emails from it, send an
 email to clojure+unsubscr...@googlegroups.com.
 For more options, visit https://groups.google.com/d/optout.


-- 
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 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
--- 
You received this message because you are subscribed to the Google Groups 
Clojure group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Is Korma still a good current choice for DB backend?

2014-07-24 Thread Tony Tam
I've been using korma in a side-project for a while and it behaves well.
There sure are a bunch of PRs on their github that could be merged, not 
sure what's up with that.

One problem I ran into last week was that I got some conflicts when trying 
to upgrade the versions of some dependencies.

One benefit of using korma is that it uses a connection/statement pooling 
library underneath (in this case c3p0), something that I don't think 
yesql/honeysql do.

-- 
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 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
--- 
You received this message because you are subscribed to the Google Groups 
Clojure group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Is Korma still a good current choice for DB backend?

2014-07-24 Thread Jonathon McKitrick
That's a handy feature, which I got running on my own to save a lot of
connection time in a batch process.  But it's probably easy enough to get
running on your own.


--
Jonathon McKitrick


On Thu, Jul 24, 2014 at 9:23 PM, Tony Tam ttasteri...@gmail.com wrote:

 I've been using korma in a side-project for a while and it behaves well.
 There sure are a bunch of PRs on their github that could be merged, not
 sure what's up with that.

 One problem I ran into last week was that I got some conflicts when trying
 to upgrade the versions of some dependencies.

 One benefit of using korma is that it uses a connection/statement pooling
 library underneath (in this case c3p0), something that I don't think
 yesql/honeysql do.

  --
 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 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
 ---
 You received this message because you are subscribed to a topic in the
 Google Groups Clojure group.
 To unsubscribe from this topic, visit
 https://groups.google.com/d/topic/clojure/rDyYHfC01RQ/unsubscribe.
 To unsubscribe from this group and all its topics, send an email to
 clojure+unsubscr...@googlegroups.com.
 For more options, visit https://groups.google.com/d/optout.


-- 
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 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
--- 
You received this message because you are subscribed to the Google Groups 
Clojure group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: More Clojure XML challenges

2014-07-24 Thread Adrian O'Sullivan
Great, thanks for the feedback.  Will try it tomorrow.

On Thursday, July 24, 2014 7:22:35 PM UTC-4, Stan wrote:


 On 07/24/2014 02:45 PM, Adrian O'Sullivan wrote: 
  I'm really struggling to understand how to parse XML in Clojure. 
  
  Here's my xml: 
  
  javancss 
 function 
  namejava.complexity.HelloWorld.notcomplex()/name 
ncss2/ncss 
ccn1/ccn 
javadocs0/javadocs 
  /function 
  function 
  namejava.complexity.HelloWorld.complex(int)/name 
ncss4/ncss 
ccn2/ccn 
javadocs0/javadocs 
  /function 
  ... etc 
  
  I can do (xml-seq (xml/parse .. )) on this, or ( zip/xml-zip 
   (xml/parse ... ), I don't mind which. 
  
  My task is to extract all the function elements where the ncss value  
  3, then sum the ccn values of the remaining elements.  I simply cannot 
  figure out how to do this.  All I can do is extract text of particular 
  elements, e.g. 
  
  (apply + (map read-string (zf/xml- ncss-zip :functions :function :ccn 
   zf/text))) 
  
  If anyone can help out, it would be much appreciated. 
  -- 

 Parsing XML without using XPath is (IMHO) a fool's errand... 

 Use the excellent clojure saxon library https://github.com/pjt/saxon   
 [clojure-saxon 0.9.4] 

 (require '[saxon :as sax]) 

 (def xml (sax/compile-xml javancss 
 function 
 namejava.complexity.HelloWorld.notcomplex()/name 
ncss2/ncss 
ccn1/ccn 
javadocs0/javadocs 
  /function 
  function 
 namejava.complexity.HelloWorld.complex(int)/name 
ncss4/ncss 
ccn2/ccn 
javadocs0/javadocs 
  /function ...)) 

 (def sum-ncss (sax/compile-xquery sum(//function[ncss=3]/ncss)))   
 ;;creates a function 

 (sum-ncss xml) 

 will return what you're looking for. 

 Hope this helps, 

 StanD. 


-- 
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 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
--- 
You received this message because you are subscribed to the Google Groups 
Clojure group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Is this behavior with recur and pre/post a bug?

2014-07-24 Thread Ambrose Bonnaire-Sergeant
Hi Michael,

I believe your post condition should read {:post [(number? %)]}.

Thanks,
Ambrose


On Fri, Jul 25, 2014 at 6:56 AM, Michael O'Keefe michael.p.oke...@gmail.com
 wrote:

 Hello All,

 I encountered the following behavior in Clojure 1.6 and wanted to check if
 it should be considered a bug or not. I would say yes but wanted to double
 check on the list first.

 Here's a minimal test case that elicited the error:

 (defn f

   [xs acc]
   (if (nil? xs)
 acc
 (recur (next xs) (+ (first xs) acc

 (f [1 2 3 4] 0) = 10


 Now, if I want to add pre/post conditions, the following happens:

 (defn g

   [xs acc]
   {:pre [(or (nil? xs) (sequential? xs)) (number? acc)]
:post [number?]}
   (if (nil? xs)
 acc
 (recur (next xs) (+ (first xs) acc


 = this fails to compile with CompilerException
 java.lang.UnsupportedOperationException: Can only recur from tail position


 In fact, it is only the post-condition that triggers the issue.

 My guess would be that the recur statement is being knocked out of tail
 position by the mechanism for handling the post-condition assertion. It can
 be fixed in the code by adding an explicit loop:

 (defn g2 [xs acc]
   {:pre [(or (nil? xs) (sequential? xs)) (number? acc)]
:post [number?]}
   (loop [xs xs
  acc acc]
 (if (nil? xs)
   acc
   (recur (next xs) (+ (first xs) acc)


 Thanks,

 Michael O'Keefe

 --
 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 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
 ---
 You received this message because you are subscribed to the Google Groups
 Clojure group.
 To unsubscribe from this group and stop receiving emails from it, send an
 email to clojure+unsubscr...@googlegroups.com.
 For more options, visit https://groups.google.com/d/optout.


-- 
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 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
--- 
You received this message because you are subscribed to the Google Groups 
Clojure group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Is this behavior with recur and pre/post a bug?

2014-07-24 Thread Michael O'Keefe
Thank you everyone, for the replies:


   - The macro expansion was helpful
   - Andy, thanks for pointing out where the lines are -- very helpful
   - Ambrose, both (number? %) and number? are valid post-condition forms; 
   the issue is that the post-condition check bumps the recur out of tail 
   position

I guess the real question: is this worth filing a ticket for?

Thanks all,

Michael



On Thursday, July 24, 2014 9:17:23 PM UTC-6, Ambrose Bonnaire-Sergeant 
wrote:

 Hi Michael,

 I believe your post condition should read {:post [(number? %)]}.

 Thanks,
 Ambrose


 On Fri, Jul 25, 2014 at 6:56 AM, Michael O'Keefe michael@gmail.com 
 javascript: wrote:

 Hello All,

 I encountered the following behavior in Clojure 1.6 and wanted to check 
 if it should be considered a bug or not. I would say yes but wanted to 
 double check on the list first.

 Here's a minimal test case that elicited the error:

 (defn f

   [xs acc]
   (if (nil? xs)
 acc
 (recur (next xs) (+ (first xs) acc

 (f [1 2 3 4] 0) = 10


 Now, if I want to add pre/post conditions, the following happens: 

 (defn g 

   [xs acc]
   {:pre [(or (nil? xs) (sequential? xs)) (number? acc)]
:post [number?]}
   (if (nil? xs)
 acc
 (recur (next xs) (+ (first xs) acc


 = this fails to compile with CompilerException 
 java.lang.UnsupportedOperationException: Can only recur from tail position


 In fact, it is only the post-condition that triggers the issue.

 My guess would be that the recur statement is being knocked out of tail 
 position by the mechanism for handling the post-condition assertion. It can 
 be fixed in the code by adding an explicit loop:

 (defn g2 [xs acc]
   {:pre [(or (nil? xs) (sequential? xs)) (number? acc)]
:post [number?]}
   (loop [xs xs
  acc acc]
 (if (nil? xs)
   acc
   (recur (next xs) (+ (first xs) acc)

  
 Thanks,

 Michael O'Keefe
  
 -- 
 You received this message because you are subscribed to the Google
 Groups Clojure group.
 To post to this group, send email to clo...@googlegroups.com 
 javascript:
 Note that posts from new members are moderated - please be patient with 
 your first post.
 To unsubscribe from this group, send email to
 clojure+u...@googlegroups.com javascript:
 For more options, visit this group at
 http://groups.google.com/group/clojure?hl=en
 --- 
 You received this message because you are subscribed to the Google Groups 
 Clojure group.
 To unsubscribe from this group and stop receiving emails from it, send an 
 email to clojure+u...@googlegroups.com javascript:.
 For more options, visit https://groups.google.com/d/optout.




-- 
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 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
--- 
You received this message because you are subscribed to the Google Groups 
Clojure group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Is this behavior with recur and pre/post a bug?

2014-07-24 Thread Ambrose Bonnaire-Sergeant
On Fri, Jul 25, 2014 at 12:13 PM, Michael O'Keefe 
michael.p.oke...@gmail.com wrote:


- Ambrose, both (number? %) and number? are valid post-condition
forms; the issue is that the post-condition check bumps the recur out of
tail position



I'm aware of the context, I just wanted to make sure you were aware that
{:post [number?]} is a no-op.

Thanks,
Ambrose

-- 
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 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
--- 
You received this message because you are subscribed to the Google Groups 
Clojure group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Is this behavior with recur and pre/post a bug?

2014-07-24 Thread Andy Fingerhut
I do not see any straightforward change to Clojure that would enable this
to work (someone else might, though).  Given that adding a loop form inside
the function is a fairly straightforward workaround to the limitation, and
the difficulty of enhancing it to avoid the limitation, I would personally
be a bit surprised to see such a ticket accepted.

It doesn't cost anything but some time to create one, though.

Andy


On Thu, Jul 24, 2014 at 9:13 PM, Michael O'Keefe michael.p.oke...@gmail.com
 wrote:

 Thank you everyone, for the replies:


- The macro expansion was helpful
- Andy, thanks for pointing out where the lines are -- very helpful
- Ambrose, both (number? %) and number? are valid post-condition
forms; the issue is that the post-condition check bumps the recur out of
tail position

 I guess the real question: is this worth filing a ticket for?

 Thanks all,

 Michael



 On Thursday, July 24, 2014 9:17:23 PM UTC-6, Ambrose Bonnaire-Sergeant
 wrote:

 Hi Michael,

 I believe your post condition should read {:post [(number? %)]}.

 Thanks,
 Ambrose


 On Fri, Jul 25, 2014 at 6:56 AM, Michael O'Keefe michael@gmail.com
 wrote:

 Hello All,

 I encountered the following behavior in Clojure 1.6 and wanted to check
 if it should be considered a bug or not. I would say yes but wanted to
 double check on the list first.

 Here's a minimal test case that elicited the error:

 (defn f

   [xs acc]
   (if (nil? xs)
 acc
 (recur (next xs) (+ (first xs) acc

 (f [1 2 3 4] 0) = 10


 Now, if I want to add pre/post conditions, the following happens:

 (defn g

   [xs acc]
   {:pre [(or (nil? xs) (sequential? xs)) (number? acc)]
:post [number?]}
   (if (nil? xs)
 acc
 (recur (next xs) (+ (first xs) acc


 = this fails to compile with CompilerException 
 java.lang.UnsupportedOperationException:
 Can only recur from tail position


 In fact, it is only the post-condition that triggers the issue.

 My guess would be that the recur statement is being knocked out of tail
 position by the mechanism for handling the post-condition assertion. It can
 be fixed in the code by adding an explicit loop:

 (defn g2 [xs acc]
   {:pre [(or (nil? xs) (sequential? xs)) (number? acc)]
:post [number?]}
   (loop [xs xs
  acc acc]
 (if (nil? xs)
   acc
   (recur (next xs) (+ (first xs) acc)


 Thanks,

 Michael O'Keefe

 --
 You received this message because you are subscribed to the Google
 Groups Clojure group.
 To post to this group, send email to clo...@googlegroups.com

 Note that posts from new members are moderated - please be patient with
 your first post.
 To unsubscribe from this group, send email to
 clojure+u...@googlegroups.com

 For more options, visit this group at
 http://groups.google.com/group/clojure?hl=en
 ---
 You received this message because you are subscribed to the Google
 Groups Clojure group.
 To unsubscribe from this group and stop receiving emails from it, send
 an email to clojure+u...@googlegroups.com.

 For more options, visit https://groups.google.com/d/optout.


  --
 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 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
 ---
 You received this message because you are subscribed to the Google Groups
 Clojure group.
 To unsubscribe from this group and stop receiving emails from it, send an
 email to clojure+unsubscr...@googlegroups.com.
 For more options, visit https://groups.google.com/d/optout.


-- 
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 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
--- 
You received this message because you are subscribed to the Google Groups 
Clojure group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Is this behavior with recur and pre/post a bug?

2014-07-24 Thread Michael O'Keefe
Ambrose, thanks -- I was NOT aware of that. Sorry I misunderstood your 
original.

Andy, good advice and I agree. Thanks. I'll think on it then.

Cheers,

Michael

On Thursday, July 24, 2014 10:20:57 PM UTC-6, Ambrose Bonnaire-Sergeant 
wrote:

 On Fri, Jul 25, 2014 at 12:13 PM, Michael O'Keefe michael@gmail.com 
 javascript: wrote:


- Ambrose, both (number? %) and number? are valid post-condition 
forms; the issue is that the post-condition check bumps the recur out of 
tail position 



 I'm aware of the context, I just wanted to make sure you were aware that 
 {:post [number?]} is a no-op.

 Thanks,
 Ambrose
  

-- 
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 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
--- 
You received this message because you are subscribed to the Google Groups 
Clojure group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.