3131
3232(defun upgraded-array-element-type (typespec &optional environment)
3333 (declare (ignore environment))
34- (if (eq typespec ' character)
35- ' character
36- t ))
34+ (case typespec
35+ (character ' character)
36+ ((nil ) (error " NIL array element type unimplemented" ))
37+ (t t )))
3738
3839(defun %array-to-lists (array )
3940 (let ((index 0 ))
@@ -65,7 +66,7 @@ in which case ARRAY might be partially filled from CONTENTS."
6566 (process (array-dimensions array ) contents)
6667 array )))
6768
68- (defun make-array (dimensions &key element-type
69+ (defun make-array (dimensions &key ( element-type t )
6970 (initial-element nil initial-element-p)
7071 (initial-contents nil initial-contents-p)
7172 adjustable
@@ -80,21 +81,20 @@ in which case ARRAY might be partially filled from CONTENTS."
8081 (error " make-array - invalid FILL-POINTER ~a ." fill-pointer )))
8182 (t (error " make-array - bad FILL-POINTER ~s type ~a ." fill-pointer (type-of fill-pointer ))))
8283 ; ; Upgrade type
83- (if ( eq element-type ' character )
84- ( progn
85- (oset 1 array " stringp " )
86- ( setf element-type ' character
87- initial-element ( or initial-element #\space )))
88- ( setf element-type t ))
84+ (setq element-type ( upgraded-array- element-type element-type) )
85+ ( case element-type
86+ ( character
87+ (oset 1 array " stringp " )
88+ ( unless initial-element-p
89+ ( setq initial-element #\space )) ))
8990 (when (and (listp dimensions)
9091 (not (null (cdr dimensions)))
9192 fill-pointer )
9293 (error " make-array - FILL-POINTER cannot be specified on multidimensional arrays." ))
9394 ; ; Record metadata
9495 (when (or (null dimensions) (cdr dimensions))
9596 (setf (oget array " dimensions" ) dimensions))
96- (setf (oget array " type" ) element-type
97- (oget array " fillpointer" ) fill-pointer )
97+ (setf (oget array " fillpointer" ) fill-pointer )
9898 ; ; Initialize array
9999 (when (and initial-element-p initial-contents-p)
100100 (error " make-array - INITIAL-ELEMENT and INITIAL-CONTENTS cannot both be provided" ))
@@ -114,9 +114,8 @@ in which case ARRAY might be partially filled from CONTENTS."
114114(defun array-element-type (array )
115115 (unless (arrayp array )
116116 (error " ~S is not an array." array ))
117- (if (eq (oget array " stringp" ) 1 )
118- ' character
119- (oget array " type" )))
117+ (cond ((eq (oget array " stringp" ) 1 ) ' character)
118+ (t t )))
120119
121120(defun array-dimensions (array )
122121 (unless (arrayp array )
0 commit comments