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!