summaryrefslogtreecommitdiffstats
path: root/mwexpand.scm
diff options
context:
space:
mode:
authorDavid N. Welton <davidw@efn.org>1998-11-09 21:18:01 -0800
committerBryan Newbold <bnewbold@robocracy.org>2017-02-20 00:05:27 -0800
commit926b1b647ac830660933a5e63eb52d4a2552e264 (patch)
treee25db5f6e1441d67f5d9af063432018ee20a5f51 /mwexpand.scm
parentb21cac3362022718634f7086964208b2eed8e897 (diff)
parentfa3f23105ddcf07c5900de47f19af43d1db1b597 (diff)
downloadslib-926b1b647ac830660933a5e63eb52d4a2552e264.tar.gz
slib-926b1b647ac830660933a5e63eb52d4a2552e264.zip
Import Debian changes 2c3-3debian/2c3-3
slib (2c3-3) frozen unstable; urgency=low * Fixes #16235. * Fixes #19943. * Fixes #20265. * Fixes #24917. * Fixes #27389. slib (2c3-2) frozen unstable; urgency=low * Re-uploaded for slink freeze. slib (2c3-1) unstable; urgency=low * New upstream release.
Diffstat (limited to 'mwexpand.scm')
-rw-r--r--mwexpand.scm17
1 files changed, 17 insertions, 0 deletions
diff --git a/mwexpand.scm b/mwexpand.scm
index 10083a3..a53f0da 100644
--- a/mwexpand.scm
+++ b/mwexpand.scm
@@ -146,6 +146,8 @@
((eq? keyword mw:denote-of-let-syntax) (mw:let-syntax exp env))
((eq? keyword mw:denote-of-letrec-syntax)
(mw:letrec-syntax exp env))
+ ; @@ case has a nontrivial syntax also -- wdc
+ ((eq? keyword mw:denote-of-case) (mw:case exp env))
; @@ let, let*, letrec, paint within quasiquotation -- kend
((eq? keyword mw:denote-of-let) (mw:let exp env))
((eq? keyword mw:denote-of-let*) (mw:let* exp env))
@@ -394,6 +396,21 @@
exp)
)
+; CASE -- added by wdc
+(define (mw:case exp env)
+ (let ((expand (lambda (exp)
+ (mw:expand exp env))))
+ (if (< (mw:safe-length exp) 3)
+ (mw:error "Malformed case expression" exp env)
+ `(case ,(expand (cadr exp))
+ ,@(map (lambda (clause)
+ (if (< (mw:safe-length exp) 2)
+ (mw:error "Malformed case clause" exp env)
+ (cons (mw:strip (car clause))
+ (map expand (cdr clause)))))
+ (cddr exp))))))
+
+
; LET
(define (mw:let exp env)
(let* ( (name (if (or (pair? (cadr exp)) (null? (cadr exp)))