From 4977b427d840de3390b802cef297b7c233fe2436 Mon Sep 17 00:00:00 2001 From: Aryadev Chavali Date: Sun, 9 Feb 2025 12:35:12 +0000 Subject: Implement a `while' macro. --- lib.macros.lisp | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'lib.macros.lisp') diff --git a/lib.macros.lisp b/lib.macros.lisp index bf0bdcc..f96636d 100644 --- a/lib.macros.lisp +++ b/lib.macros.lisp @@ -61,3 +61,8 @@ Like the `|>' operator in Ocaml." :for canon-func = (if (symbolp func) (list func) func) :do (setq acc (append canon-func (list acc))) :finally (return acc)))) + +(defmacro while (condition &body body) + `(loop :while ,condition + :do + (progn ,@body))) -- cgit v1.2.3-13-gbd6f