Lisp HUG Maillist Archive

getting the type

hello,

How can I get the type of something in Lisp?
for example:
(get-type "hola") -> string
(get-type 2) -> integer

Thanks

--
Mauricio Toro Bermudez
Estudiante de Ingeniería de Sistemas
Pontificia Universidad Javeriana, Colombia

Stagiare à l'Ircam
1, place Igor-Stravinsky 75004 Paris,
France de 2008 à 2009

Re: getting the type

Unable to parse email body. Email id is 8371

RE: getting the type

Ø  How can I get the type of something in Lisp?

Ø  for example:

Ø  (get-type "hola") -> string

Ø  (get-type 2) -> integer

 

type-of (albeit not the exact output you are showing above though).

 

For example: (type-of 2) -> FIXNUM


This should be close enough for what you want to do.

 

Z

getting the type

On Thu, 10 Jul 2008 16:06:34 +0200, Mauricio Toro <mauriciotorob@gmail.com> writes:
 > How can I get the type of something in Lisp?

Besides TYPE-OF, you should look into TYPEP.

For classes that you create yourself, sometimes it's also 
useful to implement predicate functions whose semantics
go beyond the type lattice.


Updated at: 2020-12-10 08:42 UTC