From: Didier Verna
Subject: [Q] What is a simple vector, really ?
Date: 
Message-ID: <muxvf0o3paz.fsf@uzeb.lrde.epita.fr>
        Hi !

I'm a bit confused about what is simple vector. It seems that I can't specify
the type of the elements. Here's what I get with CMU CL:


CL-USER> (setf foo (make-array 10))
Warning:  Declaring FOO special.
#(0 0 0 0 0 0 0 0 0 0)
CL-USER> (svref foo 5)
0
CL-USER> (setf bar (make-array 10 :element-type 'fixnum))
Warning:  Declaring BAR special.
#(0 0 0 0 0 0 0 0 0 0)
CL-USER> (svref bar 5)
; Evaluation aborted ====> #(0 0 0 0 0 0 0 0 0 0) is not a SIMPLE-VECTOR
CL-USER> 


So, what's going on, and what's more efficient between:

1/ not issuing the :element-type declaration, even if it's known
2/ doing it, but staying with aref and not using svref


Thanks.

-- 
Didier Verna, ······@lrde.epita.fr, http://www.lrde.epita.fr/~didier

EPITA / LRDE, 14-16 rue Voltaire   Tel.+33 (1) 44 08 01 85
94276 Le Kremlin-Bic�tre, France   Fax.+33 (1) 53 14 59 22   ······@xemacs.org

From: Wade Humeniuk
Subject: Re: [Q] What is a simple vector, really ?
Date: 
Message-ID: <ksTZe.310805$on1.171920@clgrps13>
Didier Verna wrote:
>         Hi !
> 
> I'm a bit confused about what is simple vector. It seems that I can't specify
> the type of the elements. Here's what I get with CMU CL:
> 
> 
> CL-USER> (setf foo (make-array 10))
> Warning:  Declaring FOO special.
> #(0 0 0 0 0 0 0 0 0 0)
> CL-USER> (svref foo 5)
> 0
> CL-USER> (setf bar (make-array 10 :element-type 'fixnum))
> Warning:  Declaring BAR special.
> #(0 0 0 0 0 0 0 0 0 0)
> CL-USER> (svref bar 5)
> ; Evaluation aborted ====> #(0 0 0 0 0 0 0 0 0 0) is not a SIMPLE-VECTOR
> CL-USER> 
> 
> 
> So, what's going on, and what's more efficient between:
> 
> 1/ not issuing the :element-type declaration, even if it's known
> 2/ doing it, but staying with aref and not using svref
> 

See the CLHS for the definition of s SIMPLE-VECTOR

http://www.lispworks.com/documentation/HyperSpec/Body/t_smp_ve.htm#simple-vector

Simply, simple-vectors can hold any type.

Your example does not work because its a simple-array holding only
fixnums.

CL-USER 6 > (type-of (make-array 10 :element-type 'fixnum))
(SIMPLE-ARRAY (SIGNED-BYTE 32) (10))

Wade
From: Kent M Pitman
Subject: Re: [Q] What is a simple vector, really ?
Date: 
Message-ID: <u3bnmggup.fsf@nhplace.com>
Didier Verna <······@lrde.epita.fr> writes:

>         Hi !
> 
> I'm a bit confused about what is simple vector. It seems that I
> can't specify the type of the elements.

"simple vector" != "simple" "vector".

I apologize for this presentationally in the spec.  I was aware of
the problem, but from an editorial point of view, my hands were tied.
Fixing the terminology required an incompatible change to the language
that no one was prepared to make.  (I guess I could have left out the
glossary term "simple", but I don't know if that would have, uh, made
things more simple...)

In CLTL1, "we" originally went to call them "simple general vectors" but
as I recall [*] there was an aversion to the long and cumbersome name.
There was concern, among other things, we'd have to call the operator 
SGVREF, and that people would not like the name.

But if you still think of "simple vector" and the corresponding type
SIMPLE-VECTOR as meaning "simple general vector", that is, not just
"simple" and "vector" but "having element type T" (hence, informally,
"general"), you'll get into less trouble. 

[1] I believe this was discussed at the very first meeting of the CLTL
    design committee that I attended (in 1982, in Pittsburgh).  I knew
    a lot of the people on the committee, and a lot about Lisp at that
    point, but no one was looking to me to make guiding decisions.  I
    was there somewhat by accident originally, and then continued to stay
    involved after that because it seemed fun/interesting.  I have very
    vivid memories of that first meeting because of the rapid-fire and
    seemingly arbitrary / overly hurried way in which very important 
    decisions were rushed through...  People had studied the issues in
    advance, so had come well-informed, but even so, there were huge
    divides in ways people wanted to do things that were ironed out in
    almost no time at all. (Perhaps there was a hidden consensus that the
    major players had and they just wanted to railroad it through past 
    minor opposition, though I wasn't able at that point to discern such
    things.  I only know due to later such situations I've seen that it
    sometimes works that way and that was seems rushed is really careful
    thought by people who've worked hard behind the scenes trying hard
    not to be randomized by people at a meeting who think there's still
    time to make a change.)