Fix read-syntax on vectors and arrays
authorAndy Wingo <wingo@pobox.com>
Thu, 25 Feb 2021 09:27:22 +0000 (10:27 +0100)
committerAndy Wingo <wingo@pobox.com>
Thu, 25 Feb 2021 15:07:47 +0000 (16:07 +0100)
* module/ice-9/read.scm (%read): Strip annotations from reading
the array elements.

module/ice-9/read.scm

index 5b375e19348c6fd50283518085fd608c991b504b..0724c6664aee23f1c535f905eb62c8773caba620 100644 (file)
             (error "unknown character name ~a" tok))))))))
 
   (define (read-vector)
-    (list->vector (read-parenthesized #\))))
+    (list->vector (map strip-annotation (read-parenthesized #\)))))
 
   (define (read-srfi-4-vector ch)
     (read-array ch))
     (expect #\u)
     (expect #\8)
     (expect #\()
-    (u8-list->bytevector (read-parenthesized #\))))
+    (u8-list->bytevector (map strip-annotation (read-parenthesized #\)))))
 
   ;; FIXME: We should require a terminating delimiter.
   (define (read-bitvector)
     (define (read-elements ch rank)
       (unless (eqv? ch #\()
         (error "missing '(' in vector or array literal"))
-      (let ((elts (read-parenthesized #\))))
+      (let ((elts (map strip-annotation (read-parenthesized #\)))))
         (if (zero? rank)
             (begin
               ;; Handle special print syntax of rank zero arrays; see