diff options
Diffstat (limited to 'lib.macros.lisp')
-rw-r--r-- | lib.macros.lisp | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/lib.macros.lisp b/lib.macros.lisp index f96636d..057a89f 100644 --- a/lib.macros.lisp +++ b/lib.macros.lisp @@ -66,3 +66,15 @@ Like the `|>' operator in Ocaml." `(loop :while ,condition :do (progn ,@body))) + +(deftype -> (args result) + "Type alias for function." + `(function ,args ,result)) + +(defmacro fn (name lambda-list type &body body) + "Construct a function `NAME' with a declared function type `TYPE' that takes +arguments `LAMBDA-LIST' with body `BODY'." + `(progn + (declaim (ftype ,type ,name)) + (defun ,name ,lambda-list + ,@body))) |