aboutsummaryrefslogtreecommitdiff
path: root/code.scm
diff options
context:
space:
mode:
authorHugo Hörnquist <hugo@lysator.liu.se>2019-03-01 15:23:57 +0100
committerHugo Hörnquist <hugo@lysator.liu.se>2019-03-01 15:23:57 +0100
commitb814f06b57e4e442d5f115865d26dfc427c3338a (patch)
tree096d23adfd823c9f8d31da7bf87f63c65e338e6a /code.scm
parentFix memmory error. (diff)
downloadcalp-b814f06b57e4e442d5f115865d26dfc427c3338a.tar.gz
calp-b814f06b57e4e442d5f115865d26dfc427c3338a.tar.xz
Add color-if and for-each-in macros.
Diffstat (limited to '')
-rwxr-xr-xcode.scm11
1 files changed, 11 insertions, 0 deletions
diff --git a/code.scm b/code.scm
index 6586a9af..bbfc6e9a 100755
--- a/code.scm
+++ b/code.scm
@@ -38,3 +38,14 @@
(time<=? (date->time-utc input-date)
(date->time-utc then)))))
+
+(define-syntax-rule (color-if pred color body ...)
+ (let ((pred-value pred))
+ (format #f "~a~a~a"
+ (if pred-value color "")
+ (begin body ...)
+ (if pred-value STR-RESET ""))))
+
+(define-syntax-rule (for-each-in lst proc)
+ (for-each proc lst))
+