aboutsummaryrefslogtreecommitdiff
path: root/module/util.scm
diff options
context:
space:
mode:
Diffstat (limited to 'module/util.scm')
-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) ...)