Clojure
What Is Clojure?
- A functional programming language
- Runs on the JVM, CLR, and wherever javascript runs
- A Lisp
The Lispyness of clojure
"Lisp is the only language with the moxie to expose the AST as the language" - Someone
2 + 3 * 4 - 5 (- (+ 2 (* 3 4)) 5)
On The JVM (and clr & Javascript)
- Great java interop
- Produces Java byte code
- As portable as java
- Good concurrency support
- Garbage collected
Tooling
- Leiningen
- Lighttable/emacs/vi/IntelliJ (others?)
- Clojars (and other artifact repositories from Java land)
- Jenkins
REPL DEVELOPMENT
- Instant feedback as you develop
- Easy to explore APIs
- More on this in the demo...
- Instant feedback as you develop
- Easy to explore APIs
- More on this in the demo...
A Functional Language
- Higher Order Functions (functions can be passed as arguments to other functions)
- Immutable Data Structures
- Promotes hygienic, side effect free writing, allows it when you need it
- Recursion
Let's Think of AN Example!
- We have a non-relational database full of contacts
- We want to grab the e-mail address
- If it's a gmail user, we want to e-mail them and let them know that gmail might be filtering us to promotions, and please move us out of promotions.
- Demo Code: https://github.com/philipsdoctor/clojure-talk-demo
For a Bit more Fun, lets try CLJS!
- Clojurescript compiles to javascript and then runs in your browser
- Syntactically almost identical to clojure
- Good JS interop
- Very young, still growing quickly
- Back to code !
Closing Thoughts
The Good
- Super short code
- REPL development
- Easy to test/few bugs
- A LOT OF FUN!
The Bad
- Tech is still young, especially cljs, expect added dev time for warts
- Documentation is mostly non-existent for most libraries, prepare to github
- Stack traces are the worst I've ever seen in my life
Clojure
By Philip Doctor
Clojure
- 1,453