Skip to content
Snippets Groups Projects
Commit 38abf511 authored by ram's avatar ram
Browse files

Changed #a reader to allow arbitrary sequences instead of just lists.

parent 44e433ab
No related branches found
No related tags found
No related merge requests found
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
;;; Scott Fahlman or slisp-group@cs.cmu.edu. ;;; Scott Fahlman or slisp-group@cs.cmu.edu.
;;; ;;;
(ext:file-comment (ext:file-comment
"$Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/code/sharpm.lisp,v 1.9 1992/02/12 01:44:58 ram Exp $") "$Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/code/sharpm.lisp,v 1.10 1992/07/10 17:47:42 ram Exp $")
;;; ;;;
;;; ********************************************************************** ;;; **********************************************************************
;;; ;;;
...@@ -184,24 +184,24 @@ ...@@ -184,24 +184,24 @@
(read stream t nil t) (read stream t nil t)
(return-from sharp-A nil)) (return-from sharp-A nil))
(unless dimensions (%reader-error stream "No dimensions argument to #A.")) (unless dimensions (%reader-error stream "No dimensions argument to #A."))
(if (> dimensions 0) (collect ((dims))
(let ((dlist (make-list dimensions)) (let* ((contents (read stream t nil t))
(init-list (seq contents))
(if (char= (read-char stream t) #\() (dotimes (axis dimensions
(read-list stream nil) (make-array (dims) :initial-contents contents))
(%reader-error stream "Array values must be a list.")))) (unless (typep seq 'sequence)
(do ((dl dlist (cdr dl)) (%reader-error stream
(il init-list (car il))) "#~DA axis ~D is not a sequence:~% ~S"
;; I think the nreverse is causing the problem. dimensions axis seq))
((null dl)) (let ((len (length seq)))
(if (listp il) (dims len)
(rplaca dl (length il)) (unless (= axis (1- dimensions))
(%reader-error (when (zerop len)
stream (%reader-error stream
"Initial contents for #A is inconsistent with ~ "#~DA axis ~D is empty, but is not ~
dimensions: #~SA~S" dimensions init-list))) the last dimension."
(make-array dlist :initial-contents init-list)) dimensions axis))
(make-array nil :initial-element (read stream t nil t)))) (setq seq (elt seq 0))))))))
(defun sharp-S (stream sub-char numarg) (defun sharp-S (stream sub-char numarg)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment