Clojure
Like many other clojurians, my clojure journey started with this presentation by Rich Hickey: Simple Made Easy.
Get started
most easy way is using Leiningen, after installed lein
lein new hellocd hellolein repl
first thing to learn is how to get help:
(pprint (loaded-libs))to get currently loaded namespaces- use
dirto get list of available functions, for example(dir clojure.string),ns-publicsto get the mapping - use
docto get more info,(doc clojure.string/replace) - use
sourceto show source code,(source clojure.string/replace) - use
find-docto search, accepts a regexp,(find-doc #"javadoc")
(above functions are under clojure.repl namespace)
to show methods of an java object:
(map str (vec (.getMethods (.getClass theJavaObject))))Style Guide
check this repo for clojure style guide: bbatsov/clojure-style-guide · GitHub
you can also find best practices for the very confusing ns form: :require, :import, :use, :refer
Editor
for quick start Light Table is great.
IDE style may try IntelliJ with JetBrains/la-clojure.
My reading notes
- Professional Clojure
- Clojure for the Brave and True
- Living Clojure
- Programming Clojure
- Clojure Programming
Snippets
run any class inside a jar
java -cp my-standalone.jar clojure.main -m my.classResources
quick reference
documentation
library directory
news
exercise
- 4clojure (also see the 4clojure notes page)
- Clojure Koans
books
Clojure for the brave and true is a good place to start with.
some other free books, from vhf/free-programming-books · GitHub:
- A Brief Beginner’s Guide To Clojure
- Clojure - Functional Programming for the JVM
- Clojure Cheat Sheet
- Clojure Cookbook
- Clojure Distilled Beginner Guide
- Clojure for the Brave and True
- Clojure in Small Pieces - Rich Hickey
- Clojure Programming
- ClojureScript Koans
- Data Sorcery with Clojure
- Modern cljs
- The Clojure Style Guide