Debian Codegraph @

%3a61/cond.sls

raw
1 #!r6rs
2 ;; Copyright 2009 Derick Eddington. My MIT-style license is in the file named
3 ;; LICENSE from the original collection this file is distributed with.
4
5 (library (srfi :61 cond)
6 (export
7 (rename (general-cond cond)))
8 (import
9 (rnrs))
10
11 (define-syntax general-cond
12 (lambda (stx)
13 (syntax-case stx ()
14 ((_ clauses ...)
15 (with-syntax (((ours ...)
16 (map (lambda (c)
17 (syntax-case c (=>)
18 ((generator guard => receiver)
19 #'((let-values ((vals generator))
20 (and (apply guard vals)
21 vals))
22 => (lambda (vals)
23 (apply receiver vals))))
24 (_ c)))
25 #'(clauses ...))))
26 #'(cond ours ...))))))
27 )