From 415ce75b066526125c5647e54b0db4821f4ddc54 Mon Sep 17 00:00:00 2001 From: Sean Whitton Date: Thu, 18 Mar 2021 09:05:16 -0700 Subject: introduce FORM-BEGINNING-WITH Signed-off-by: Sean Whitton --- src/util.lisp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src/util.lisp') diff --git a/src/util.lisp b/src/util.lisp index 2d35e0c..c4b4df2 100644 --- a/src/util.lisp +++ b/src/util.lisp @@ -79,8 +79,11 @@ supported." ,@(and docstring `(,docstring)) (error ',name :format-control message :format-arguments args)))) +(defmacro form-beginning-with (sym form) + `(and (listp ,form) (eq ',sym (car ,form)))) + (defun strip-declarations (forms) - (loop while (and (listp (car forms)) (eq 'declare (caar forms))) + (loop while (form-beginning-with declare (car forms)) do (pop forms) finally (return forms))) -- cgit v1.2.3