aboutsummaryrefslogtreecommitdiff
path: root/module/util.scm
diff options
context:
space:
mode:
authorHugo Hörnquist <hugo@lysator.liu.se>2020-08-17 10:17:33 +0200
committerHugo Hörnquist <hugo@lysator.liu.se>2020-08-17 10:17:33 +0200
commitf7e489178120813a4aff0eff0140661bf402cbae (patch)
treec55d3ec6ee869a29dd892c8573734df6e18236f6 /module/util.scm
parentSetup directories for dist. (diff)
downloadcalp-f7e489178120813a4aff0eff0140661bf402cbae.tar.gz
calp-f7e489178120813a4aff0eff0140661bf402cbae.tar.xz
Work on paths?
Diffstat (limited to '')
-rw-r--r--module/util.scm17
1 files changed, 17 insertions, 0 deletions
diff --git a/module/util.scm b/module/util.scm
index d5cf86a7..17400c3b 100644
--- a/module/util.scm
+++ b/module/util.scm
@@ -300,6 +300,12 @@
(if (> i (string-length str))
str (string-take str i)))
+(define-public (string-first str)
+ (string-ref str 0))
+
+(define-public (string-last str)
+ (string-ref str (1- (string-length str))))
+
(define-public (as-symb s)
(if (string? s) (string->symbol s) s))
@@ -546,6 +552,17 @@
+(define-syntax catch-warnings
+ (syntax-rules ()
+ ((_ default body ...)
+ (parametrize ((warnings-are-errors #t))
+ (catch 'warning
+ (lambda ()
+ body ...)
+ (lambda _ default))))))
+
+
+
(define-syntax let-env
(syntax-rules ()
[(_ ((name value) ...)