In article
danb <sogwaldan@xxxxxxxxx> wrote:

* (array-element-type (MAKE-ARRAY '(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:

Here is an example where a Lisp does not upgrade an
element type:

? (array-element-type (MAKE-ARRAY '(2)

See also these examples:

? (array-element-type (MAKE-ARRAY '(2)
:ELEMENT-TYPE '(unsigned-byte 4)

? (array-element-type (MAKE-ARRAY '(2)
:ELEMENT-TYPE '(unsigned-byte 9)


Dan Bensen

cl-match: expressive pattern matching in Lisp


Relevant Pages

  • Re: modifying array access syntax
    ... >>> possible performance drawbacks for a moment, Common Lisp appears to ... Only horrendous if you don't appreciate what function this notation ... That is, at some level, the difference between an array and a function is ...
  • Re: should (setf aref) coerce?
    ... is not quite clear what the spec requires. ... the only purpose of declarations is to allow compiler ... AFAIK array element types have ... the element type defaults to T. ...
  • Re: 3 questions about arrays
    ... array can already use up at least all of physical memory and quite ... And since the default in lisp is to not include type declarations, ... computer so a fast fixnum should be at most 32 bits. ... you as the programmer can always create larger bit vectors if you ...
  • Re: Lisp collections
    ... Lisp has it. ... > index, like a normal array. ... You should use lists when lists are the natural way to represent the ... > to inherit from enumerable-collection, and foreach should be a generic ...
  • Re: The joy of garbage collection
    ... the underlying lisp takes care of it for you. ... array and store things in it appropriate to the imaginary ... All the things you put in it don't have pointers ... > storing unboxed data in the heap ...