API for def - clojure-contrib v1.3 (in development)

by Stephen C. Gilardi

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
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
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
Usage: (defmacro- name & decls)
Same as defmacro but yields a private definition
Source


defn-memo

macro
Usage: (defn-memo fn-name & defn-stuff)
Just like defn, but memoizes the function using clojure.core/memoize
Source


defnk

macro
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
Usage: (defonce- name expr)
       (defonce- name expr doc)
Same as defonce but yields a private definition
Source


defstruct-

macro
Usage: (defstruct- name & decls)
Same as defstruct but yields a private definition
Source


defunbound

macro
Usage: (defunbound name)
       (defunbound name doc)
Defines an unbound var with optional doc string
Source


defunbound-

macro
Usage: (defunbound- name & decls)
Same as defunbound but yields a private definition
Source


defvar

macro
Usage: (defvar name)
       (defvar name init)
       (defvar name init doc)
Defines a var with an optional intializer and doc string
Source


defvar-

macro
Usage: (defvar- name & decls)
Same as defvar but yields a private definition
Source


name-with-attributes

function
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
Logo & site design by Tom Hickey.
Clojure auto-documentation system by Tom Faulhaber.