SRFI 34 from Schematics

svn: r1056
This commit is contained in:
Chongkai Zhu 2005-10-12 23:15:00 +00:00
parent 02687a1744
commit 0a6f0dd09b
3 changed files with 32 additions and 4 deletions

View File

@ -47,17 +47,15 @@
(define (get-translating-acks)
(string-append
"Thanks to "
"ChongKai Zhu, "
"Ian Barland, "
"Biep Durieux, "
"Tim Hanson, "
"Chihiro Kuraya, "
"Paulo Jorge Matos, "
"Philippe Meunier, "
"Jens Axel Søgaard, "
"Francisco Solsona, "
"Reini Urban, "
"Paolo Zoppetti, "
"and "
"Zhu Chongkai "
"Paolo Zoppetti "
"for their help translating DrScheme's GUI to other languages.")))

5
collects/srfi/34.ss Executable file
View File

@ -0,0 +1,5 @@
;; module loader for SRFI-34
(module |34| mzscheme
(require (lib "exception.ss" "srfi" "34"))
(provide (all-from (lib "exception.ss" "srfi" "34"))
raise))

25
collects/srfi/34/exception.ss Executable file
View File

@ -0,0 +1,25 @@
;; SRFI 34 for PLT Scheme
;; Zhu Chongkai, April 2005
;; <mrmathematica@yahoo.com>
(module exception mzscheme
(provide with-exception-handler
guard)
(define-syntax with-exception-handler
(syntax-rules ()
((_ handler thunk)
(with-handlers (((lambda (exn) #t) handler)) (thunk)))))
(define-syntax guard
(syntax-rules (else)
((_ (var clause ... (else de ...)) e1 e2 ...)
(with-handlers (((lambda (exn) #t)
(lambda (var) (cond clause ...
(else de ...)))))
e1 e2 ...))
((_ (var clause ...) e1 e2 ...)
(with-handlers (((lambda (exn) #t)
(lambda (var) (cond clause ...
(else (raise var))))))
e1 e2 ...)))))