From 59ca6e4cd05f1e6df0cdb5131617d0044db00247 Mon Sep 17 00:00:00 2001 From: Gergely Nagy Date: Fri, 17 Jan 2014 12:05:35 +0100 Subject: [PATCH] docs: Document (defmacro-alias) Signed-off-by: Gergely Nagy --- docs/language/api.rst | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/docs/language/api.rst b/docs/language/api.rst index 76a8918..8d58fc9 100644 --- a/docs/language/api.rst +++ b/docs/language/api.rst @@ -445,6 +445,32 @@ between the operands. => (infix (1 + 1)) 2 +.. _defmacro-alias: + +defmacro-alias +-------------- + +`defmacro-alias` is used to define macros with multiple names +(aliases). The general format is `(defmacro-alias [names] [parameters] +expr)`. It creates multiple macros with the same parameter list and +body, under the specified list of names. + +The following example defines two macros, both of which allow the user +to write code in infix notation. + +.. code-block:: clj + + => (defmacro-alias [infix infi] [code] + ... (quasiquote ( + ... (unquote (get code 1)) + ... (unquote (get code 0)) + ... (unquote (get code 2))))) + + => (infix (1 + 1)) + 2 + => (infi (1 + 1)) + 2 + .. _defmacro/g!: defmacro/g!