[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

simple vector



Dear MCLers:

I got confused about simple vector.

I'm using MCL 2.0 final. I can make a simple vector of which
:element-type is 'integer and can refer it's elements by svref.

--------------------
? (setq foo (make-array 10 :element-type 'integer :initial-element 0
                        :adjustable nil :fill-pointer nil :displaced-to nil))
#(0 0 0 0 0 0 0 0 0 0)
? (svref foo 0)
0
?
--------------------

But when I make a vector of which :element-type is fixnum, referrence
by svref causes an error as follows.

--------------------
? (setq bar (make-array 10 :element-type 'fixnum :initial-element 0
                        :adjustable nil :fill-pointer nil :displaced-to nil))
#(0 0 0 0 0 0 0 0 0 0)
? (svref bar 0)
> Error: value #<VECTOR 10 type (SIGNED-BYTE 32), simple> is not of the expected type SIMPLE-VECTOR.
> While executing: CCL::TOPLEVEL-EVAL
> Type Command-. to abort.
See the RestartsI menu item for further choices.
1 > 
Aborted
?
--------------------

Why make-array returns simple vector when :element-type is 'integer
and dose not return simple vector when :element-type is 'fixnum? I
feel it queer because fixnum is a subtype of integer, but Sun4 Allegro
Common Lisp causes same error...

And MCL says me that bar is array and vector and simple-array, but not
simple-vecotor.

--------------------
? (typep bar 'array)
T
? (typep bar 'vector)
T
? (typep bar 'simple-array)
T
? (typep bar 'simple-vector)
NIL
?
--------------------

I referred CLtL2 but I can not understand these results well. Any
suggestions are welcome.

--- Thanks ---
Masaya UEDA
Information System R&D Center, SHARP Co.
2613-1 Ichinomoto, Tenri, Nara 632, JAPAN