diff options
author | Hugo Hörnquist <hugo@lysator.liu.se> | 2023-02-23 01:08:16 +0100 |
---|---|---|
committer | Hugo Hörnquist <hugo@lysator.liu.se> | 2023-09-11 19:58:54 +0200 |
commit | 7bdc4a32ff775bca0158533c9e9af250f16cceb7 (patch) | |
tree | b5d04869ec8867be717d37af97c1173d2922cd56 /module/hnh | |
parent | Change `kvlist->assq` and `group-by` to return pairs. (diff) | |
download | calp-7bdc4a32ff775bca0158533c9e9af250f16cceb7.tar.gz calp-7bdc4a32ff775bca0158533c9e9af250f16cceb7.tar.xz |
Extend `for'-macro to allow improper list elements.
Diffstat (limited to '')
-rw-r--r-- | module/hnh/util.scm | 13 |
1 files changed, 13 insertions, 0 deletions
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 ...)))]) <collection>))))) + ((for (<var> <vars> ... . <tail>) in <collection> b1 body ...) + #'(call/ec + (lambda (break) + (map ((@ (ice-9 match) match-lambda) + [(<var> <vars> ... . <tail>) + (call/ec + (lambda (raw-continue) + (let ((continue + (case-lambda + (() #f) + (args (apply raw-continue args))))) + b1 body ...)))]) + <collection>)))) ((for <var> in <collection> b1 body ...) (with-syntax ((break (datum->syntax stx 'break)) (continue (datum->syntax stx 'continue))) |