From aa22a98a4d5fb60119aea0689017d7ee546335db Mon Sep 17 00:00:00 2001 From: Tony Garnock-Jones Date: Tue, 2 Aug 2016 19:13:51 -0400 Subject: [PATCH] Avoid eager evaluation of maybe-splice contents. --- src/html-utils.rkt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/html-utils.rkt b/src/html-utils.rkt index 717e04b..15bfc31 100644 --- a/src/html-utils.rkt +++ b/src/html-utils.rkt @@ -9,8 +9,8 @@ ;; Boolean XExpr ... -> (Listof XExpr) ;; Useful for optionally splicing in some contents to a list. ;; If the guard is true, returns the contents; otherwise returns the empty list. -(define (maybe-splice guard . contents) - (if guard contents '())) +(define-syntax-rule (maybe-splice guard contents ...) + (if guard (list contents ...) '())) ;; Extracts named single-valued bindings from the given request. ;; If a given binding is missing, the extracted value will be #f.