[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
8.8.2 Instances
You can use the is-a?
predicate to ask whether any given value
belongs to a given class, or class-of
to discover the class of a
given value. Note that when GOOPS is loaded (by code using the
(oop goops)
module) built-in classes like <string>
,
<list>
and <number>
are automatically set up,
corresponding to all Guile Scheme types.
(is-a? 2.3 <number>) ⇒ #t (is-a? 2.3 <real>) ⇒ #t (is-a? 2.3 <string>) ⇒ #f (is-a? '("a" "b") <string>) ⇒ #f (is-a? '("a" "b") <list>) ⇒ #t (is-a? (car '("a" "b")) <string>) ⇒ #t (is-a? <string> <class>) ⇒ #t (is-a? <class> <string>) ⇒ #f (class-of 2.3) ⇒ #<<class> <real> 908c708> (class-of #(1 2 3)) ⇒ #<<class> <vector> 908cd20> (class-of <string>) ⇒ #<<class> <class> 8bd3e10> (class-of <class>) ⇒ #<<class> <class> 8bd3e10>
This document was generated on April 20, 2013 using texi2html 5.0.