aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorColin Okay <cbeok@protonmail.com>2020-07-14 13:30:23 -0500
committerColin Okay <cbeok@protonmail.com>2020-07-14 13:30:23 -0500
commit8c4ddae952469d7c97ccea76c8c8894b7be925e1 (patch)
tree16816bb0c0195a538335522d6bc69705185ca01e
parentcf4317625629a3a80dc05eb8ea48f32a59dec430 (diff)
putting for's body in unwind protect
-rw-r--r--gtwiwtg.lisp9
1 files changed, 5 insertions, 4 deletions
diff --git a/gtwiwtg.lisp b/gtwiwtg.lisp
index 14c0048..10eb1ab 100644
--- a/gtwiwtg.lisp
+++ b/gtwiwtg.lisp
@@ -779,10 +779,11 @@ A -- 4
`(let ((,var-exp (next ,gen-var))) ,@body))))
`(let ((,gen-var ,gen))
(assert (typep ,gen-var 'gtwiwtg::generator!))
- (loop
- :while (has-next-p ,gen-var)
- :do
- ,expr-body)
+ (unwind-protect
+ (loop
+ :while (has-next-p ,gen-var)
+ :do
+ ,expr-body))
(stop ,gen-var))))
(defmacro fold ((acc init-val) (var-exp gen) expr)