diff options
author | Hugo Hörnquist <hugo@lysator.liu.se> | 2019-04-30 01:10:00 +0200 |
---|---|---|
committer | Hugo Hörnquist <hugo@lysator.liu.se> | 2019-04-30 01:10:00 +0200 |
commit | 0288287f06e3afb4f40459da412206dceaf8067e (patch) | |
tree | e664075cfdff5695c6c2d77a88ce25033c59e35b /module/util.scm | |
parent | Fix makefile so all also builds guile code. (diff) | |
download | calp-0288287f06e3afb4f40459da412206dceaf8067e.tar.gz calp-0288287f06e3afb4f40459da412206dceaf8067e.tar.xz |
Replace 'when' and 'unless'.
Diffstat (limited to 'module/util.scm')
-rw-r--r-- | module/util.scm | 11 |
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 |