Mal Web REPL


Mal at a glance


Maps {"key1" "val1", "key2" 123}
Lists (1 2 3 "four")
Vectors [1 2 3 4 "a" "b" "c" 1 2]
Scalars a-symbol, "a string", :a_keyword, 123, nil, true, false


Calling (<function> <args*>)
Defining named functions (def! <name> (fn* [<args*>] <action>))
Anonymous function (fn* [<args*>] <action>)

Useful Macros and Special Forms

Conditionals if cond or
Multiple Actions (side-effects) (do <action*>...)
Defining things def! defmacro! let*
Quoting ' ` ~ ~@
Examining macros macroexpand

Useful Functions

Math + - * /
Comparison/Boolean = < > <= >= not
Predicates nil? true? false? symbol? keyword? string? list? vector? map? sequential?
Data processing map apply
Data create list vector hash-map
Data inspection first rest get keys vals count get nth contains? empty?
Data manipulation conj cons concat assoc dissoc
Lists and Vectors first rest nth seq
Hash Maps get keys vals contains?
Strings str pr-str seq
Atoms atom atom? deref[@] reset! swap!
Meta meta with-meta[^]
Output println prn

JavaScript Interop

Evaluate JavaScript (js-eval "JS string to eval")
Method call/access (. js-fn arg...)