Re: Function ARRAY-ELEMENT-TYPE
- From: Rainer Joswig <joswig@xxxxxxx>
- Date: Mon, 05 May 2008 21:11:28 +0200
In article
<96353525-4cf6-4cdf-b02a-09159e43252b@xxxxxxxxxxxxxxxxxxxxxxxxxxxx>,
danb <sogwaldan@xxxxxxxxx> wrote:
* (array-element-type (MAKE-ARRAY '(2)
:ELEMENT-TYPE 'INTEGER
:INITIAL-CONTENTS '(1 2)))
=> T
Why does this function exist? It doesn't seem to do much.
Which function? array-element-type ?
It returns the type T in your example. That's fine.
Your Lisp has decided that the element type of
the above array is of type T. Means it
does not have a special array type for
arrays with element type INTEGER.
Read about Array Upgrading:
http://www.lisp.org/HyperSpec/Body/sec_15-1-2-1.html
Here is an example where a Lisp does not upgrade an
element type:
? (array-element-type (MAKE-ARRAY '(2)
:ELEMENT-TYPE 'fixnum
:INITIAL-CONTENTS '(1 2)))
FIXNUM
See also these examples:
? (array-element-type (MAKE-ARRAY '(2)
:ELEMENT-TYPE '(unsigned-byte 4)
:INITIAL-CONTENTS '(1 2)))
(UNSIGNED-BYTE 8)
? (array-element-type (MAKE-ARRAY '(2)
:ELEMENT-TYPE '(unsigned-byte 9)
:INITIAL-CONTENTS '(1 2)))
(UNSIGNED-BYTE 16)
--Dan
------------------------------------------------
Dan Bensen
http://www.prairienet.org/~dsb/
cl-match: expressive pattern matching in Lisp
http://common-lisp.net/project/cl-match/
--
http://lispm.dyndns.org/
.
- Follow-Ups:
- Re: Function ARRAY-ELEMENT-TYPE
- From: danb
- Re: Function ARRAY-ELEMENT-TYPE
- References:
- Function ARRAY-ELEMENT-TYPE
- From: danb
- Function ARRAY-ELEMENT-TYPE
- Prev by Date: Re: Function ARRAY-ELEMENT-TYPE
- Next by Date: Re: Function ARRAY-ELEMENT-TYPE
- Previous by thread: Re: Function ARRAY-ELEMENT-TYPE
- Next by thread: Re: Function ARRAY-ELEMENT-TYPE
- Index(es):
Relevant Pages
|