[gambit-list] Type checking

Stephane Le Cornec coleste at videotron.ca
Thu Jan 10 11:43:47 EST 2008


At 10:56 AM -0500 1/10/08, Joel J. Adamson wrote:
>Dear Gambit List,
>
>I have a set of datatypes defined with c-define-type based on the GNU
>Scientific Library.  The Gambit-C manual says "For type checking
>on the Scheme side..." to use the TAG function of the  type definition
>as in
>
>(c-define-type gsl-matrix* (pointer gsl-matrix "gsl-matrix*"))

IIRC, you only use the tag if you multiple c-define-type that are equivalent.

(c-define-type type1* (pointer type1 #f)
(c-define-type type2* (pointer type2 "type")
(c-define-type type3* (pointer type3 "type")

Here all 3 types are exchangeable.


>What is the best way to use this to define a boolean test
>(e.g. gsl-matrix*?) for this type?  I feel like I must be missing
>something since the explanation of type checking stops with how to
>define the TAG and how it's printed in the external representation of an
>object of that type.

NULL converts to #f, if that's what you're asking.
-- 
Stephane!
coleste at videotron.ca (Stephane Le Cornec)
+------------------- Made with recycled electrons. --------------------+
| #include <disclaimer.h>                             Kebekkujin desu. |
+----------------------------------------------------------------------+



More information about the Gambit-list mailing list