add back support for #y bitvector read syntax
authorAndy Wingo <wingo@pobox.com>
Thu, 15 Oct 2009 13:05:36 +0000 (15:05 +0200)
committerAndy Wingo <wingo@pobox.com>
Thu, 15 Oct 2009 13:05:36 +0000 (15:05 +0200)
* module/ice-9/deprecated.scm (#\y): Add deprecated support for
  #y(1 0 1 ...) bitvectors.

module/ice-9/deprecated.scm

index c8d7621..c55e13b 100644 (file)
          `(begin *unspecified* . ,exps)))
    (else
     `(begin))))
+
+(read-hash-extend
+ #\y
+ (lambda (c port)
+   (issue-deprecation-warning
+    "The `#y' bitvector syntax is deprecated.  Use `#*' instead.")
+   (let ((x (read port)))
+     (cond
+      ((list? x)
+       (list->bitvector
+        (map (lambda (x)
+               (cond ((zero? x) #f)
+                     ((eqv? x 1) #t)
+                     (else (error "invalid #y element" x))))
+             x)))
+      (else
+       (error "#y needs to be followed by a list" x))))))