summaryrefslogtreecommitdiff
path: root/module/system/base/syntax.scm
diff options
context:
space:
mode:
authorAndy Wingo <wingo@pobox.com>2008-05-03 14:52:36 +0200
committerAndy Wingo <wingo@pobox.com>2008-05-03 14:52:36 +0200
commit1aa0dd2b4529d19b78f344c921fb71e38fbbee19 (patch)
treee50dd3e69b7391e4417dafdf94d31229f436a326 /module/system/base/syntax.scm
parent7ef8d0a0086c932d7507025137eedd2546d39f8d (diff)
downloadguile-1aa0dd2b4529d19b78f344c921fb71e38fbbee19.tar.gz
Convert assemble.scm to use record-case.
* module/system/base/syntax.scm (record?): Temporarily export this thing, so that code will remain correct when I change to srfi-9 records. * module/system/vm/assemble.scm: Convert to use record-case.
Diffstat (limited to 'module/system/base/syntax.scm')
-rw-r--r--module/system/base/syntax.scm14
1 files changed, 12 insertions, 2 deletions
diff --git a/module/system/base/syntax.scm b/module/system/base/syntax.scm
index 6c98b90c4..3a61ea6f6 100644
--- a/module/system/base/syntax.scm
+++ b/module/system/base/syntax.scm
@@ -175,11 +175,21 @@
(cond ,@(map process-clause clauses)
(else (error "unhandled record" ,r))))))
+;; These are short-lived, and headed to the chopping block.
(use-modules (ice-9 match))
(define-macro (record-case record . clauses)
(define (process-clause clause)
- `(($ ,@(car clause)) ,@(cdr clause)))
- `(match ,record ,(map process-clause clauses)))
+ (if (eq? (car clause) 'else)
+ clause
+ `(($ ,@(car clause)) ,@(cdr clause))))
+ `(match ,record ,@(map process-clause clauses)))
+
+(define (record? x)
+ (and (vector? x)
+ (not (zero? (vector-length x)))
+ (symbol? (vector-ref x 0))
+ (eqv? (string-ref (symbol->string (vector-ref x 0)) 0) #\<)))
+(export record?)
;;;