From 0288287f06e3afb4f40459da412206dceaf8067e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hugo=20H=C3=B6rnquist?= Date: Tue, 30 Apr 2019 01:10:00 +0200 Subject: Replace 'when' and 'unless'. --- module/util.scm | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'module/util.scm') diff --git a/module/util.scm b/module/util.scm index 97483222..2a995777 100644 --- a/module/util.scm +++ b/module/util.scm @@ -9,7 +9,8 @@ catch-multiple quote? tree-map let-lazy) - #:replace (let* set! define-syntax)) + #:replace (let* set! define-syntax + when unless)) ((@ (guile) define-syntax) define-syntax (syntax-rules () @@ -141,6 +142,14 @@ +(define-syntax-rule (when pred body ...) + (if pred (begin body ...) '())) + +(define-syntax-rule (unless pred body ...) + (if pred '() (begin body ...))) + + + ;; Allow set to work on multiple values at once, ;; similar to Common Lisp's @var{setf} ;; @example -- cgit v1.2.3