common lisp - How to determine the datatype of a variable -
it easy answer question (i guess), looked while not finding direct question you.
there typep determine whether given variable of specific data-type e.g. integer,hashtable etc. , there function returns data-type?
e.g.
(defvar *x* 1) *x* (typep *x* 'integer) t (the-type-function *x*) integer
there typep determine whether given variable of specific data-type e.g. integer,hashtable etc. ,
not really. in common lisp variables not typed think.
(defvar *x* 1) *x* (typep *x* 'integer) t above says nothing type of variable *x*. confirms object 1 of type integer.
but there function returns data-type?
not really. there function type-of, returns type of object, not of variable.
> (type-of 1) fixnum there no difference when value variable.
> (type-of *x*) fixnum but not mean variable has type.
note: common lisp has types , type declarations. looks different.
Comments
Post a Comment