From 104baa03842ed0c2eeba1979f6a2d3d0accf154e Mon Sep 17 00:00:00 2001 From: Matthew Butterick Date: Sat, 17 Mar 2018 09:02:24 -0700 Subject: [PATCH] also `for*/splice` --- pollen/core.rkt | 18 +++++++++++++----- pollen/private/ts.rktd | 2 +- 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/pollen/core.rkt b/pollen/core.rkt index 4e0d191..da11b5f 100644 --- a/pollen/core.rkt +++ b/pollen/core.rkt @@ -118,20 +118,28 @@ (provide when/splice) (define-syntax (when/splice stx) (syntax-case stx () - [(_ COND BODY ...) + [(_ COND . BODY) (with-syntax ([SPLICING-TAG (datum->syntax stx (setup:splicing-tag))]) #'(if COND (with-handlers ([exn:fail? (λ (exn) (error (format "within when/splice, ~a" (exn-message exn))))]) - (SPLICING-TAG BODY ...)) + (SPLICING-TAG . BODY)) (SPLICING-TAG)))])) -(provide for/splice) +(provide for/splice for*/splice) (define-syntax (for/splice stx) (syntax-case stx () [(_ ([ID SEQ] ...) . BODY) - #'(when/splice #t (for/list ([ID SEQ] ...) - (when/splice #t . BODY)))])) + (with-syntax ([SPLICING-TAG (datum->syntax stx (setup:splicing-tag))]) + #'(apply SPLICING-TAG (for/list ([ID SEQ] ...) + (SPLICING-TAG . BODY))))])) + +(define-syntax (for*/splice stx) + (syntax-case stx () + [(_ ([ID SEQ] ...) . BODY) + (with-syntax ([SPLICING-TAG (datum->syntax stx (setup:splicing-tag))]) + #'(apply SPLICING-TAG (for*/list ([ID SEQ] ...) + (SPLICING-TAG . BODY))))])) (provide when/block) ; bw compat (define-syntax-rule (when/block cond body ...) diff --git a/pollen/private/ts.rktd b/pollen/private/ts.rktd index 337d289..f030ab0 100644 --- a/pollen/private/ts.rktd +++ b/pollen/private/ts.rktd @@ -1 +1 @@ -1521242140 +1521302544