(->camelCase method-name)
(borrow-macros & syms)
Many Clojure macros work the same in Chlorine. Use this function to reuse them instead of rewriting.
Many Clojure macros work the same in Chlorine. Use this function to reuse them instead of rewriting.
(detect-form expr)
Detects macro/function/special form names from expressions for further processing. Used as dispatch function for chlorine.js/emit, the most hardworking multi-method in chlorine library.
Detects macro/function/special form names from expressions for further processing. Used as dispatch function for chlorine.js/emit, the most hardworking multi-method in chlorine library.
Receives forms, emits javascript expressions.
Receives forms, emits javascript expressions.
(emit-block-if test consequent alternate)
(emit-case e clauses)
(emit-delimited delimiter args & [emitter])
Emit sequences with delimiters. Useful to emit javascript arrays, function arguments etc.
Emit sequences with delimiters. Useful to emit javascript arrays, function arguments etc.
(emit-docstring docstring)
Prints docstrings as javascript comments.
Prints docstrings as javascript comments.
(emit-function-call fun & args)
Emits a function call by simply emitting the function name and its arguments in parentheses.
Emits a function call by simply emitting the function name and its arguments in parentheses.
(emit-function-form form)
Emits function forms such as: unary and infix operator calls, applying keyword on a map, method calls, creating new object calls, and normal function calls.
Emits function forms such as: unary and infix operator calls, applying keyword on a map, method calls, creating new object calls, and normal function calls.
(emit-infix-operator op & args)
(emit-inline-if test consequent alternate)
(emit-invoke-function fun & args)
Like emit-function-call, but wraps the function in parentheses. Used to emit function calls where function is not a symbol but an other form instead.
Like emit-function-call, but wraps the function in parentheses. Used to emit function calls where function is not a symbol but an other form instead.
(emit-keyword expr)
Emits Clojure keywords. Uses emit-symbol as backend.
Emits Clojure keywords. Uses emit-symbol as backend.
(emit-macro-expansion form)
Gets and executes macro function, emits the result as Chlorine code.
Gets and executes macro function, emits the result as Chlorine code.
(emit-map expr)
Clojure maps are emitted to javascript key/value objects. Keys can only be strings. Keywords and quoted symbols don't really make sense in Chlorinejs and that's why they are emitted to plain strings.
Clojure maps are emitted to javascript key/value objects. Keys can only be strings. Keywords and quoted symbols don't really make sense in Chlorinejs and that's why they are emitted to plain strings.
(emit-re expr)
(emit-set expr)
Clojure sets are emitted to javascript key/value objects whose
values are all true
. These 'sets' objects as javascript nature will have
distinct elements (the keys) which can be checked by contains?
(javascript's
in
). Please remember, all set elements are coerced to strings by javascript.
That means, both (contains? 5 {:a 1 "5" 2})
and
`(contains? "5" {:b 3 5 4} will return true.
Clojure sets are emitted to javascript key/value objects whose values are all `true`. These 'sets' objects as javascript nature will have distinct elements (the keys) which can be checked by `contains?` (javascript's `in`). Please remember, all set elements are coerced to strings by javascript. That means, both `(contains? 5 {:a 1 "5" 2})` and `(contains? "5" {:b 3 5 4} will return true.
(emit-statement expr)
Emits an expression with trailing ;
and newline-indent
if necessary.
Emits an expression with trailing `;` and `newline-indent` if necessary.
(emit-statements exprs)
(emit-statements-with-return exprs)
Emits statements with the manual return
added in front of the
last expression. If the last expression in nil
, ignores it.
Emits statements with the manual `return` added in front of the last expression. If the last expression in `nil`, ignores it.
(emit-str expr)
(emit-symbol expr)
Emits Clojure symbols to javascript ones. If the symbol is quoted, emits its name as a string. Does some replacements with characters not supported by javascript if the symbol isn't marked as reserved ones.
Emits Clojure symbols to javascript ones. If the symbol is quoted, emits its name as a string. Does some replacements with characters not supported by javascript if the symbol isn't marked as reserved ones.
(emit-unary-operator op arg)
(emit-vector expr)
Clojure vectors and quoted lists are emitted as javascript arrays.
Clojure vectors and quoted lists are emitted as javascript arrays.
(expand-macro form)
Repeatedly calls expand-macro-1 on form until it no longer represents a macro form, then returns it. Note neither expand-macro-1 nor expand-macro expand macros in subforms.
Repeatedly calls expand-macro-1 on form until it no longer represents a macro form, then returns it. Note neither expand-macro-1 nor expand-macro expand macros in subforms.
(expand-macro-1 form)
Gets and executes macro function, returns the Chlorine code.
Gets and executes macro function, returns the Chlorine code.
(get-macro n)
Gets the macro function by its name in order to generate code.
Gets the macro function by its name in order to generate code.
(js & exprs)
Translate the Clojure subset `exprs' to a string of javascript code.
Translate the Clojure subset `exprs' to a string of javascript code.
(js-emit expr)
(js-let bindings & exprs)
Bind Clojure environment values to named vars of a cljs block, and translate the Clojure subset `exprs' to a string of javascript code.
Bind Clojure environment values to named vars of a cljs block, and translate the Clojure subset `exprs' to a string of javascript code.
(let-js bindings quoted-expr)
Bind Clojure environment values to named vars of a quoted cljs block, and translate the Clojure subset `exprs' to a string of javascript code.
Bind Clojure environment values to named vars of a quoted cljs block, and translate the Clojure subset `exprs' to a string of javascript code.
(macro? n)
Checks if a macro with that name is defined.
Checks if a macro with that name is defined.
(member-form? form-name)
Checks if a form is a property access or method call (a symbol starting with '.')
Checks if a form is a property access or method call (a symbol starting with '.')
(new-object? f)
Checks if a symbol is a new object call (a symbol ending with '.')
Checks if a symbol is a new object call (a symbol ending with '.')
(newline-indent)
(normalize-dot-form form)
Normalizes dot forms or new-object forms by removing "." from their beginnings or endings.
Normalizes dot forms or new-object forms by removing "." from their beginnings or endings.
(property->member property)
Removes -
prefix in a property name to bring it a member look.
Removes `-` prefix in a property name to bring it a member look.
(raw-script & scripts)
(remove-namespaces forms)
Removes all namespaces in forms using clojure.walk/postwalk.
Removes all namespaces in forms using clojure.walk/postwalk.
(sym->property s)
Transforms symbol or keyword into object's property access form.
Transforms symbol or keyword into object's property access form.
(tempsym)
Generates an unique temporary symbol.
Generates an unique temporary symbol.
(tojs & scripts)
The top-level, stateless way to compile Chlorine source files. Loads and compiles a list of cl2 scripts into javascript, and returns them in a string. This function starts its own temporary symbol count and macro memory.
The top-level, stateless way to compile Chlorine source files. Loads and compiles a list of cl2 scripts into javascript, and returns them in a string. This function starts its own temporary symbol count and macro memory.
(tojs' & scripts)
The low-level, stateful way to compile Chlorine source files. This function varies depending on states such as macros, temporary symbol count etc.
The low-level, stateful way to compile Chlorine source files. This function varies depending on states such as macros, temporary symbol count etc.
(undef-macro n)
Removes a macro from known macro list.
Removes a macro from known macro list.
(with-block & body)
(with-indent [& increment] & body)
(with-parens [& [left right]] & body)
(with-pretty-print & body)
(with-return-expr [& [new-val]] & body)
Consumes return-expr true
states or sets it to a new value.
Consumes *return-expr* `true` states or sets it to a new value.
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close