mikera
mikera

Reputation: 106351

Examples of elegant, concise code in Clojure

I'm looking for enlightening examples of concise and elegant code in Clojure - mainly to learn new techniques and improve my own style.

Can you offer any nuggets of pure genius?

Upvotes: 10

Views: 4116

Answers (4)

codefinger
codefinger

Reputation: 10318

This is fun:

(= (sort "eleven plus two") (sort "twelve plus one"))

This evaluates to true because "eleven plus two" is an anagram of "twelve plus one"

More fun than useful.

Upvotes: 7

Michael Kohl
Michael Kohl

Reputation: 66837

Basically everything Nurullah Akkaya posts:

http://nakkaya.com/

Definitely some of the most imaginative Clojure examples around. Don't blame me for all the time you'll spend reading his stuff... ;-)

Upvotes: 12

trptcolin
trptcolin

Reputation: 2340

Ring is an excellent example - very idiomatic and elegant code there.

Upvotes: 5

missingfaktor
missingfaktor

Reputation: 92056

There are loads at learnclojure on twitter. :-)

Upvotes: 4

Related Questions