such.vars

Common operations on vars.

has-function?

(has-function? v)

Does the var point to a function?

has-macro?

(has-macro? v)

Does the var point to a macro?

has-plain-value?

(has-plain-value? v)

Does the var point to something not a macro nor a function?

name-as-string

(name-as-string var)

Unlike symbols and keywords, the “name” of a var is a symbol. This function returns the string name of that symbol. See also name-as-symbol.

 (var/name-as-string #'clojure.core/even?) => "even?")

name-as-symbol

(name-as-symbol var)

Unlike symbols and keywords, the “name” of a var is a symbol. This function returns that symbol. See also name-as-string.

 (var/name-as-symbol #'clojure.core/even?) => 'even?)

Note that the symbol does not have a namespace.

Rootable

protocol

A protocol to look at “root” values of Vars. The root value is the value before any binding - it’s the value altered by alter-var-root. Defines has-root-value? and root-value.

members

has-root-value?

(has-root-value? this)

Does this var have a root value?

root-value

(root-value this)

What is the value of the var, ignoring any bindings in effect?