summary refs log tree commit diff stats
path: root/util.scm
diff options
context:
space:
mode:
authorCase Duckworth2024-05-02 22:55:16 -0500
committerCase Duckworth2024-05-02 22:55:16 -0500
commita5b4863d9702a13e96665d118f9b974bb59ae7d6 (patch)
tree874c396bd745e3569c6d8c49e54a95d213eac238 /util.scm
downloadplanet-main.tar.gz
planet-main.zip
First commit main
Diffstat (limited to 'util.scm')
-rw-r--r--util.scm22
1 files changed, 22 insertions, 0 deletions
diff --git a/util.scm b/util.scm new file mode 100644 index 0000000..0a8906c --- /dev/null +++ b/util.scm
@@ -0,0 +1,22 @@
1(declare (module (planet util))
2 (import scheme
3 (chicken base)
4 (chicken condition))
5 (export define-public))
6
7(define-syntax define-public
8 (syntax-rules ()
9 ((define-public (name . arg) forms ...)
10 (begin (export name)
11 (define (name . arg) forms ...)))
12 ((define-public (name args ...) forms ...)
13 (begin (export name)
14 (define (name args ...) forms ...)))
15 ((define-public name value)
16 (begin (export name)
17 (define name value)))))
18
19(define-public (false-on-error thunk)
20 (call/cc (lambda (k)
21 (with-exception-handler (lambda (x) (k #f))
22 thunk))))