Debian Codegraph @

%3a2/and-let%2a.sls

raw
1 #!r6rs
2 ;; Copyright 2010 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 :2 and-let*)
6 (export
7 and-let*)
8 (import
9 (rnrs))
10
11 (define-syntax and-let*
12 (syntax-rules ()
13 ((_ . r)
14 (and-let*-core #T . r))))
15
16 (define-syntax and-let*-core
17 (lambda (stx)
18 (syntax-case stx ()
19 ((kw _ ((var expr) . c) . b)
20 #'(let ((var expr))
21 (and var
22 (kw var c . b))))
23 ((kw last ((expr) . c) . b)
24 #'(kw last ((t expr) . c) . b))
25 ((kw _ (id . c) . b)
26 (identifier? #'id)
27 #'(and id
28 (kw id c . b)))
29 ((_ last ())
30 #'last)
31 ((_ _ () . b)
32 #'(let () . b)))))
33 )