GNU Common Lisp Details (Type)

If in the REPL I enter:

(type-of (make-array 5)) 

then I get the answer:

 (SIMPLE-VECTOR 5) 

Fair enough. Therefore, if in the REPL I enter:

 (type-of (make-array (list 5 3 2))) 

then I get the answer:

 (SIMPLE-ARRAY T (5 3 2)) 

I have two questions.

  • What does T tell me here? If it were NIL instead, what would they tell me?
  • Where can I find this answer on my own? I could not find the answer in (for example) Lisp HyperSpec.
+4
source share
2 answers

(SIMPLE-ARRAY T (5 3 2)) is a simple array of three dimensions. T says this is a generic array that can contain any type of element. T is the most common type.

Hyperspector documents the SIMPLE-ARRAY type here:

http://www.lispworks.com/documentation/HyperSpec/Body/t_smp_ar.htm

+8
source

1) If T was NIL, you will have a three-dimensional array specialized for storing data (not a single element is of type NIL, I believe that all types are supertype NIL).

+1
source

Source: https://habr.com/ru/post/1384113/


All Articles