ClojureScript Web REPL

NOTE: This is not an official Clojure/ClojureScript project/site. In addition the code is based on a Nov 2012 fork of ClojureScript so it is quite out of date. If you are interested in seeing something more official and recent, please refer to: Bootstrapping the Compiler.

Show file editor

ClojureScript at a glance - PDF | Searchable docs | Translations from JavaScript


Map {:key1 :val1, :key2 :val2}
Vectors [1 2 3 4 :a :b :c 1 2]
Sets #{:a :b :c 1 2 3}
Scalars a-symbol, :a-keyword, "a string"
Arrays (array 1 2 3)


Calling (<function> <args*>)
Defining named functions (defn <name> [<args*>] |constraints| <actions*>)
Anonymous function (fn |name| [<args*>] |constraints| <actions*>)
Anonymous inline function #(<action> |%,%2,%3, or %&|)

Useful Macros

Conditionals if if-let cond condp and or when when-let
Nesting, chaining, and Interop -> ->> doto .. .
Defining things def defn fn let binding defmulti defmethod deftype defrecord reify this-as

Useful Functions

Math + - * / quot rem mod inc dec max min
Comparison = == not= < > <= >=
Predicates nil? identical? zero? pos? neg? even? odd? true? false?
Data processing map reduce filter partition split-at split-with
Data create vector vec hash-map set for list list*
Data inspection first rest get get-in keys vals count get nth contains? find
Data manipulation seq into conj cons assoc assoc-in dissoc zipmap merge merge-with select-keys update-in
Arrays first rest get get-in keys vals count get nth contains? find

JavaScript Interop

Method call (.the-method target-object args...)
Property access (.-property target-object -property)
Property setting (set! (.-title js/document) "Hi!")
Direct JavaScript (js/alert "Hello Cleveland!")
External library use (.text (js/jQuery "#title") "ClojureScript Rocks!")