From 7bdc4a32ff775bca0158533c9e9af250f16cceb7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hugo=20H=C3=B6rnquist?= Date: Thu, 23 Feb 2023 01:08:16 +0100 Subject: Extend `for'-macro to allow improper list elements. --- module/hnh/util.scm | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'module') diff --git a/module/hnh/util.scm b/module/hnh/util.scm index bbb1a5ec..ea7c0dd1 100644 --- a/module/hnh/util.scm +++ b/module/hnh/util.scm @@ -133,6 +133,19 @@ b1 body ...)))]) ))))) + ((for ( ... . ) in b1 body ...) + #'(call/ec + (lambda (break) + (map ((@ (ice-9 match) match-lambda) + [( ... . ) + (call/ec + (lambda (raw-continue) + (let ((continue + (case-lambda + (() #f) + (args (apply raw-continue args))))) + b1 body ...)))]) + )))) ((for in b1 body ...) (with-syntax ((break (datum->syntax stx 'break)) (continue (datum->syntax stx 'continue))) -- cgit v1.2.3