From 35b99fb272dc917307efe9771087527d62fa81f2 Mon Sep 17 00:00:00 2001 From: Henrik Lissner Date: Wed, 20 May 2020 15:32:34 -0400 Subject: [PATCH] Add fn! macro For cl-function version of lambda, for implicit destructuring of arguments. --- core/core-lib.el | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/core/core-lib.el b/core/core-lib.el index 380c3918e..1609beb51 100644 --- a/core/core-lib.el +++ b/core/core-lib.el @@ -264,6 +264,13 @@ See `if!' for details on this macro's purpose." (macroexp-progn body))) +;;; Closure factories +(defmacro fn! (arglist &rest body) + "Expands to (cl-function (lambda ARGLIST BODY...))" + (declare (indent defun) (doc-string 1) (pure t) (side-effect-free t)) + `(cl-function (lambda ,arglist ,@body))) + + ;;; Mutation (defmacro appendq! (sym &rest lists) "Append LISTS to SYM in place."