Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Programming > Lisp > Re: Function AR...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 4 of 12 Topic 12427 of 13579
Post > Topic >>

Re: Function ARRAY-ELEMENT-TYPE

by Rainer Joswig <joswig@[EMAIL PROTECTED] > May 5, 2008 at 09:11 PM

In article 
<96353525-4cf6-4cdf-b02a-09159e43252b@[EMAIL PROTECTED]
>,
 danb <sogwaldan@[EMAIL PROTECTED]
> 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/
 




 12 Posts in Topic:
Function ARRAY-ELEMENT-TYPE
danb <sogwaldan@[EMAIL  2008-05-05 11:50:20 
Re: Function ARRAY-ELEMENT-TYPE
Zach Beane <xach@[EMAI  2008-05-05 15:07:07 
Re: Function ARRAY-ELEMENT-TYPE
Jeronimo Pellegrini <j  2008-05-05 21:07:45 
Re: Function ARRAY-ELEMENT-TYPE
Rainer Joswig <joswig@  2008-05-05 21:11:28 
Re: Function ARRAY-ELEMENT-TYPE
danb <sogwaldan@[EMAIL  2008-05-05 13:07:34 
Re: Function ARRAY-ELEMENT-TYPE
Rainer Joswig <joswig@  2008-05-05 22:29:16 
Re: Function ARRAY-ELEMENT-TYPE
pjb@[EMAIL PROTECTED] (P  2008-05-06 09:27:53 
Re: Function ARRAY-ELEMENT-TYPE
Kent M Pitman <pitman@  2008-05-05 17:37:35 
Re: Function ARRAY-ELEMENT-TYPE
danb <sogwaldan@[EMAIL  2008-05-06 09:50:57 
Re: Function ARRAY-ELEMENT-TYPE
pjb@[EMAIL PROTECTED] (P  2008-05-06 19:01:59 
Re: Function ARRAY-ELEMENT-TYPE
"John Thingstad"  2008-05-06 19:57:59 
Re: Function ARRAY-ELEMENT-TYPE
Duane Rettig <duane@[E  2008-05-06 13:12:55 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Tue Oct 7 7:58:13 CDT 2008.