summary refs log tree commit diff stats
path: root/util.scm
blob: 0a8906ca98772ebe7155d6d6ec7d79869ff487ce (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
(declare (module (planet util))
         (import scheme
                 (chicken base)
                 (chicken condition))
         (export define-public))

(define-syntax define-public
  (syntax-rules ()
    ((define-public (name . arg) forms ...)
     (begin (export name)
            (define (name . arg) forms ...)))
    ((define-public (name args ...) forms ...)
     (begin (export name)
            (define (name args ...) forms ...)))
    ((define-public name value)
     (begin (export name)
            (define name value)))))

(define-public (false-on-error thunk)
  (call/cc (lambda (k)
             (with-exception-handler (lambda (x) (k #f))
               thunk))))