1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65
|
;; -*-theme-d-*-
;; Copyright (C) 2018, 2020 Tommi Höynälänmaa
;; Distributed under GNU Lesser General Public License version 3,
;; see file doc/LGPL-3.
;; This module is imported by the core interface so we can't import it here.
(define-interface (standard-library core-forms2)
(import (standard-library core-forms)
(standard-library platform-specific-impl))
(define-syntax guard0
(syntax-rules ()
((_ (variable cond-clause ...) body)
(guard-general variable (cond cond-clause ...) body))
((_ (variable cond-clause ...) body1 ...)
(guard-general variable (cond cond-clause ...) (begin body1 ...)))))
(define-syntax guard
(syntax-rules (else)
((_ (variable cond-clause ... . ((else else-clause ...)))
body1 ...)
(guard0 (variable cond-clause ... (else else-clause ...))
body1 ...))
((_ (variable cond-clause ...) body1 ...)
(guard0 (variable cond-clause ... (else (raise variable)))
body1 ...))))
(define-syntax guard0-nonpure
(syntax-rules ()
((_ (variable cond-clause ...) body)
(guard-general-nonpure variable (cond cond-clause ...) body))
((_ (variable cond-clause ...) body1 ...)
(guard-general-nonpure variable (cond cond-clause ...)
(begin body1 ...)))))
(define-syntax guard-nonpure
(syntax-rules (else)
((_ (variable cond-clause ... . ((else else-clause ...)))
body1 ...)
(guard0-nonpure (variable cond-clause ... (else else-clause ...))
body1 ...))
((_ (variable cond-clause ...) body1 ...)
(guard0-nonpure (variable cond-clause ... (else (raise variable)))
body1 ...))))
(define-syntax guard0-without-result
(syntax-rules ()
((_ (variable cond-clause ...) body)
(guard-general-without-result variable (cond cond-clause ...) body))
((_ (variable cond-clause ...) body1 ...)
(guard-general-without-result variable (cond cond-clause ...)
(begin body1 ...)))))
(define-syntax guard-without-result
(syntax-rules (else)
((_ (variable cond-clause ... . ((else else-clause ...)))
body1 ...)
(guard0-without-result (variable cond-clause ... (else else-clause ...))
body1 ...))
((_ (variable cond-clause ...) body1 ...)
(guard0-without-result (variable cond-clause ... (else (raise variable)))
body1 ...)))))
|