ClojureScript

Why?

The simplicity and power of Clojure
combined with the reach of Javascript.

Simplicity

  • Simple, not necessarily easy
  • Data over syntax
  • Pure functions
  • Composable
  • Immutable data

Power

  • Great namespacing and library support
  • Persistent collections
  • Abstractions, seqs
  • Extensible through macros
  • Embraces the underlying platform
  • REPL

Reach

  • Clojure in the browser
  • Clojure in mobile devices
  • Clojure in NodeJS
  • ...

How?

  • Compiles a subset of Clojure to Javascript
  • Uses the Closure Compiler and Library

Closure Compiler

  • Minification
  • Optimization
  • Dead code elimination

Alpha

ClojureScript is still very young. 
There are rough edges!

ClojureScript Koans

github.com/owickstrom/clojurescript-koans

LightTable

  1. lein compile
  2. Open index.html in LightTable
  3. Open file in browser
  4. Add a tabset
  5. Open src/clojurescript_koans.cljs
  6. Move tab to next tabset
  7. Eval a form in the editor (CMD+Enter)

core.async

core.async Examples

bit.ly/1c5OFC9

  1. Clone the project
  2. Open examples/*.cljs
  3. Add connection > Clojure > Open project.clj
  4. Go wild



ClojureScript 101

swannodette.github.io/2013/11/07/clojurescript-101/

Bonus #1: Dommy

Modify to use github.com/prismatic/dommy 
for DOM queries and templating

Bonus #2: OM

refer to examples/typeahead

Stuff we did


Comment app in Om



Thank you!

ClojureScript

By oskarwickstrom

ClojureScript

  • 601