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 http://grails.org/plugin/clojure. That page includes a link to a brief video demonstration which is available at http://s3.amazonaws.com/jeffscreencasts/grails_clojure_demo.mov. 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.

Enjoy.

## Grails, SpringSource And Clojure Thursday, July 30, 2009

Posted by Jeff Brown at 4:26 PM

Labels: clojure springsource groovy

Subscribe to:
Post Comments (Atom)

## 31 comments:

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 clojure.org site and came up with this:

(ns grails

(:use clojure.contrib.math))

(def factorial

(fn [n]

(loop [cnt n acc 1]

(if (zero? cnt)

acc

(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

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!

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

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

(memoize

(fn [p n m]

(cond

(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

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

David

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

http://feboook.blogspot.com

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

酒店打工 酒店兼職

台北酒店 打工兼差 酒店工作

酒店經紀 禮服店

酒店兼差 酒店上班 酒店PT 酒店酒店喝酒 酒店消費 喝花酒 粉味

涼宮春日的憂鬱 -

情色成人小說 -

嘟嘟情色成人 -

台灣情色成人網 -

3d 動畫美女遊戲 -

情色成人影片 -

涼宮春日 h -

情色成人影音 -

網路美女照片 -

涼宮春日小說 -

美女交友 msn -

涼宮春日小說 bt -

18情色成人網 -

明星性愛裸照 -

中國性愛城 bt 區 -

免費視訊美女 -

涼宮春日的激奏 -

18禁情色成人影音 -

1中華性愛 -

情色成人短片 -

中國性愛城 bt -

中國性愛城 -

性愛圖貼 -

免費視訊美女影音觀賞 -

人妖性愛 -

性愛真諦 -

色 色 視訊網 -

免費情色成人圖片 -

bbs性愛網站 -

台灣視訊美女專區 -

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

オナニー

逆援助

SEX

フェラチオ

ソープ

逆援助

出張ホスト

手コキ

おっぱい

フェラチオ

中出し

セックス

デリヘル

包茎

逆援

性欲

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.

角色扮演,

睡衣,

SM,

潤滑液,

情趣玩具,

愛愛,

情人趣味用品,

情人趣味千奈,

情人趣味愛戀,

情趣味用品,

情趣用具,

跳蛋,

G點,

按摩棒,

跳蛋,

飛機杯,

充氣娃娃,

自慰套,

情趣娃娃,

自慰器,

情趣用品,情趣,

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!

Hallo,

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

Viele Gruesse aus dem schoenen Fischerdorf Greetsiel.

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

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.

借貸

借錢

二胎

汽車借款

酒店經紀

http://away-panic.co.cc/

http://bo-oks.info/

http://cbengine.info/

http://top-ebooks.co.cc/

http://onlineebooks.co.cc

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.

thanks for sharing this site.

You developed a great plugin.

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

android application|android web applicationOh, so evocative! I'll get me staff doing the work. Thanks a lot for sharing this stuff.

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

I really appreciate the way you are sharing your experiences.

http://www.squidoo.com/show-plates-uk

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

Interesting Article

Java Online Training from India | Core Java Training Online

Java Online Training | Java EE Online Training

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

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

Post a Comment