Grails, SpringSource And Clojure Thursday, July 30, 2009

I recently developed a Grails plugin which provides support for easily accessing Clojure code in a Grails app. The details of how the plugin works are covered at That page includes a link to a brief video demonstration which is available at Check it out.

Shortly after publishing the plugin I posted something about it on Twitter. Not too long after that a couple of other SpringSource folks tweeted about Clojure (here and here). I got a couple of questions (in jest I am sure) about SpringSource and Clojure. "Is SpringSource Moving To Clojure?". Of course not. SpringSource is not moving to Clojure. SpringSource is all about helping folks build serious applications for the JVM and most of that is done in Java. This is not news. I work on Groovy and Grails. Much of what I do is in Groovy. This too is not news. Making it easy for folks to use languages like Scala and Clojure while taking advantage of all the great stuff that Grails has to offer, that is appealing to me and that is why I developed the Clojure plugin.

Clojure is a really interesting language. There are others. The fact that 3 folks from SpringSource have expressed some kind of interest in Clojure shouldn't be all that surprising. There are probably even more folks at SpringSource who have some kind of interest in Clojure but for entertainment, lets focus on the 3 mentioned...

I am honestly not sure how many technologists work for SpringSource but for the sake of having a number to work with, lets say there are 50. Lets also say that Clojure is interesting enough that 15% of JVM developers are interested in learning more about it. I can't back that number up with any research, lets just go with it. If 15% of JVM developers are interested in the language and you take a random group of 50 JVM developers (the 50 in question are certainly not 50 random developers, these are the edge cutters which probably makes them more likely to be interested in keeping an eye on what is new, but work with the idea that they are random)... Do the math. No, really... Do the math. Do the math to figure out the likelihood that 3 of the 50 would be interested in Clojure. I challenge you to do the math in Clojure and post your solution in a comment here. Do it in Scala, Do it in Groovy. Pick a JVM language and do the math.

The simplest solution is probably not very interesting. Prefer a solution that shows off something interesting in your language of choice.

Hmmm... are you more likely to need to refer to the Clojure book, or the high school math book? ;)

Now, you have one more reason to tinker with a new language.



Keith Cochran said...

I'm not the best at probability, so I used the coin toss computation from Wolfram Alpha to get this particular example working. I also had to use the clojure contrib library for the math power function. Finally, I "borrowed" the factorial code from the site and came up with this:

(ns grails
(:use clojure.contrib.math))

(def factorial
(fn [n]
(loop [cnt n acc 1]
(if (zero? cnt)
(recur (dec cnt) (* acc cnt))))))

(defn probability
"The probability of A given B tries"
[a b]
(/ (factorial b) (* (factorial a) (factorial (- b a)) (Math/pow 2 b))))


Keith Cochran said...

Forgot to include the result:

Probability of only 3 developers in 50 interested in Clojure:

1 in 1.74E-11. That assumes that 47 are completely uninterested. A very low probability indeed!

Weiqi Gao said...

My answer got too long to fit here. So I posted it as a blog entry here.

Christophe Grand said...

Doing Math is hard, let's compute:

;; probability that at least m out of n devs are interested in Clojure
;; when the probability of being interested in Clojure is p
(def prob
(fn [p n m]
(pos? n)
(+ (* p (prob p (dec n) (dec m)))
(* (- 1 p) (prob p (dec n) m)))
(pos? m) 0
:else 1))))

(prob 0.15 50 3)
;; 0.9858114833989171

Unknown said...

We can use a binomial distribution to model this. We want to know the probability that at least 3 developers (or more than two) from a sample of 50 are interested in Clojure, and the probability that a developer is interested in Clojure is 0.15. We can use the cdf-binomial function in Incanter (a Clojure library) to calculate that probability. I'll set the :lower-tail option to false to get the probability that more than two developers are interested (the default would tells us the probability that at most two are interested).

(use 'incanter.stats)
(cdf-binomial 2 :size 50 :prob 0.15 :lower-tail false)

Which returns 0.986, so the likelihood of getting at least three developers that are interested in Clojure from the sample of 50 is over 98% (given an assumption that 15% are interested).


Anonymous said...

you have a nice site.thanks for sharing this site. various kinds of ebooks are available here

Anonymous said...

Nice article as for me. I'd like to read a bit more about that topic. Thank you for posting this information.
Sexy Lady
Call girls

Anonymous said...

酒店打工 酒店兼職
台北酒店 打工兼差 酒店工作
酒店經紀 禮服店
酒店兼差 酒店上班 酒店PT 酒店酒店喝酒 酒店消費 喝花酒 粉味

Anonymous said...

涼宮春日的憂鬱 -
情色成人小說 -
嘟嘟情色成人 -
台灣情色成人網 -
3d 動畫美女遊戲 -
情色成人影片 -
涼宮春日 h -
情色成人影音 -
網路美女照片 -
涼宮春日小說 -
美女交友 msn -
涼宮春日小說 bt -
18情色成人網 -
明星性愛裸照 -
中國性愛城 bt 區 -
免費視訊美女 -
涼宮春日的激奏 -
18禁情色成人影音 -
1中華性愛 -
情色成人短片 -
中國性愛城 bt -
中國性愛城 -
性愛圖貼 -
免費視訊美女影音觀賞 -
人妖性愛 -
性愛真諦 -
色 色 視訊網 -
免費情色成人圖片 -
bbs性愛網站 -
台灣視訊美女專區 -

Anonymous said...

Cool story you got here. I'd like to read something more concerning this topic. The only thing I would like to see on that blog is a few pics of some gizmos.
Katherine Watcerson
Cell jammer

オテモヤン said...


Webmaster said...

I appreciate the information. Java is one of the consistent player from the development industry which has been providing the wider scope for developers to come out with different solutions.

Anonymous said...




generic propecia said...

Hello people want to express my satisfaction with this blog very creative and I really like the views of the focus very good indeed Thank you for the helpful information. I hope you keep up the good work on making your blog a success!

Volker from Germany said...

Ich haben eben Eure Internetseite besucht und nutzen sogleich die Gelegenheit,euch auch einen Gruß aus Deutschland in Eurem Gästebuch zu hinterlassen. P.S. Kommt uns doch auch mal besuchen

Reinhard Sakowski said...

Viele Gruesse aus dem schoenen Fischerdorf Greetsiel.

send flowers to germany said...

I suggest this site to my friends so it could be useful & informative for them also. Great effort.

Cheap Viagra said...

Greetings Jeff Brown and readers!
I have been researching on the net in order to find some affairs which are surely going to help me n my way to finish a High School proyect. Anyway, What I meant is that this column made my day.

咪摩兔 said...


Anonymous said...

iPhone Developers said...

We want to know the probability that at least 3 developers (or more than two) from a sample of 50 are interested in Clojure, and the probability that a developer is interested in Clojure is 0.15. We can use the cdf-binomial function in Incanter (a Clojure library) to calculate that probability.

Admin said...

thanks for sharing this site.

Suman Kira said...

You developed a great plugin.

Mobile Application said...

My friend recommended to this blog.... you have some awesome articles shear. keep it up the great work

android application | android web application

hotel louisville said...

Oh, so evocative! I'll get me staff doing the work. Thanks a lot for sharing this stuff.

Prank Calls said...

Nice blog and nice post! The topic here I found is really effective.

Show Plates said...

I really appreciate the way you are sharing your experiences.

Tina Fey said...

Very value able post, it keep me onto reading your whole story.

navya said...

Interesting Article

Java Online Training from India | Core Java Training Online

Java Online Training | Java EE Online Training

oracle fusion financials training in kukatpally said...

Thanks for the statistics. i discovered your blog very interesting,our java online training supplier won the high commonplace name through international for its coaching for more information please check the site

Oracle Fusion said...

Nice effort, very informative, this will help me to complete my task. Thanks for share This is just the kind of information that I had been looking for few days.
Oracle Fusion HCM Technical Training