Returns the type of a specified item
(type item)
The data type of item. Items that evaluate to nil (such as unassigned symbols) return nil. The data type is returned as one of the atoms listed in the following table:
For example, given the following assignments:
(setq a 123 r 3.45 s "Hello!" x '(a b c))
(setq f (open "name" "r"))
(type 'a) returns SYM
(type a) returns INT
(type f) returns FILE
(type r) returns REAL
(type s) returns STR
(type x) returns LIST
(type +) returns SUBR
(type nil) returns nil
The following code example uses the type function on the argument passed to it:
(defun isint (a)
(if (= (type a) 'INT) is TYPE integer?
T yes, return T
nil no, return nil
)
)