aboutsummaryrefslogtreecommitdiff
path: root/module/util.scm
diff options
context:
space:
mode:
authorHugo Hörnquist <hugo@lysator.liu.se>2019-04-30 01:10:00 +0200
committerHugo Hörnquist <hugo@lysator.liu.se>2019-04-30 01:10:00 +0200
commit0288287f06e3afb4f40459da412206dceaf8067e (patch)
treee664075cfdff5695c6c2d77a88ce25033c59e35b /module/util.scm
parentFix makefile so all also builds guile code. (diff)
downloadcalp-0288287f06e3afb4f40459da412206dceaf8067e.tar.gz
calp-0288287f06e3afb4f40459da412206dceaf8067e.tar.xz
Replace 'when' and 'unless'.
Diffstat (limited to 'module/util.scm')
-rw-r--r--module/util.scm11
1 files changed, 10 insertions, 1 deletions
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