API for def
- ()
by Stephen C. Gilardi
clojure-contrib is now deprecated
clojure-contrib is no longer being developed or maintained.
Rather than a single, monolithic, contributions library, Clojure now has
a set of separate libraries for each unit of functionality. The libraries
are in the Clojure GitHub organization at
https://github.com/clojure.
API documentation of the libraries can be found at
https://clojure.github.io.
If you're looking for a specific function or namespace from the old
clojure-contrib, see
"Where Did Clojure.Contrib Go".
Full namespace name:
clojure.contrib.def
Overview
def.clj provides variants of def that make including doc strings and
making private definitions more succinct.
Public Variables and Functions
defalias
macro
This library, clojure-contrib, is deprecated. See here for more information.
Usage: (defalias name orig)
(defalias name orig doc)
Defines an alias for a var: a new var with the same root binding (if
any) and similar metadata. The metadata of the alias is its initial
metadata (as provided by def) merged into the metadata of the original.
Source
defhinted
macro
This library, clojure-contrib, is deprecated. See here for more information.
Usage: (defhinted sym init)
Defines a var with a type hint matching the class of the given
init. Be careful about using any form of 'def' or 'binding' to a
value of a different type. See http://paste.lisp.org/display/73344
Source
defmacro-
macro
This library, clojure-contrib, is deprecated. See here for more information.
Usage: (defmacro- name & decls)
Same as defmacro but yields a private definition
Source
defn-memo
macro
This library, clojure-contrib, is deprecated. See here for more information.
Usage: (defn-memo fn-name & defn-stuff)
Just like defn, but memoizes the function using clojure.core/memoize
Source
defnk
macro
This library, clojure-contrib, is deprecated. See here for more information.
Usage: (defnk fn-name & fn-tail)
Define a function accepting keyword arguments. Symbols up to the first
keyword in the parameter list are taken as positional arguments. Then
an alternating sequence of keywords and defaults values is expected. The
values of the keyword arguments are available in the function body by
virtue of the symbol corresponding to the keyword (cf. :keys destructuring).
defnk accepts an optional docstring as well as an optional metadata map.
Source
defonce-
macro
This library, clojure-contrib, is deprecated. See here for more information.
Usage: (defonce- name expr)
(defonce- name expr doc)
Same as defonce but yields a private definition
Source
defstruct-
macro
This library, clojure-contrib, is deprecated. See here for more information.
Usage: (defstruct- name & decls)
Same as defstruct but yields a private definition
Source
defunbound
macro
This library, clojure-contrib, is deprecated. See here for more information.
Usage: (defunbound name)
(defunbound name doc)
Defines an unbound var with optional doc string
Source
defunbound-
macro
This library, clojure-contrib, is deprecated. See here for more information.
Usage: (defunbound- name & decls)
Same as defunbound but yields a private definition
Source
defvar
macro
This library, clojure-contrib, is deprecated. See here for more information.
Usage: (defvar name)
(defvar name init)
(defvar name init doc)
Defines a var with an optional intializer and doc string
Source
defvar-
macro
This library, clojure-contrib, is deprecated. See here for more information.
Usage: (defvar- name & decls)
Same as defvar but yields a private definition
Source
name-with-attributes
function
This library, clojure-contrib, is deprecated. See here for more information.
Usage: (name-with-attributes name macro-args)
To be used in macro definitions.
Handles optional docstrings and attribute maps for a name to be defined
in a list of macro arguments. If the first macro argument is a string,
it is added as a docstring to name and removed from the macro argument
list. If afterwards the first macro argument is a map, its entries are
added to the name's metadata map and the map is removed from the
macro argument list. The return value is a vector containing the name
with its extended metadata map and the list of unprocessed macro
arguments.
Source