Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 647
mikera Avatar asked Nov 02 '10 17:11

mikera


3 Answers

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

like image 186
Michael Kohl Avatar answered Nov 16 '22 04:11

Michael Kohl


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.

like image 6
codefinger Avatar answered Nov 16 '22 04:11

codefinger


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

like image 5
trptcolin Avatar answered Nov 16 '22 06:11

trptcolin