# auto-gensym

special charactersince v0.0-927 in clojureEdit

Shorthand for generating unique symbols inside a ``` syntax quote`` template.

  • foo# => foo__135__auto__


Auto-generates a unique symbol with the given prefix, particularly one that will not shadow any existing symbol in its resulting scope. This is intended as a convenience for creating hygienic macros without calling gensym directly.

Every symbol matching a unique foo# symbol within a syntax quoted form will be replaced with the same generated symbol.

``(foo# foo#)=>(foo__138__auto__ foo__138__auto__)`

Namespace-qualified symbols foo/bar# are not replaced.


;;=> foo__142__auto__

Namespace-qualified symbols are left alone.

;;=> foo/bar#

Create safe local bindings:

`(let [x# 1]
   (+ x# 2))
;;=> (cljs.user/let [x__146__auto__ 1] (cljs.user/+ x__146__auto__ 2))

See Also: