I want a function that gets the type of a value at runtime. Example use:
(get-type a)
where a has been defined to be some arbitrary Scheme value.
How do I do this? Or do I have to implement this myself, using a cond stack of boolean?, number? etc. ?
In Scheme implementations with a Tiny-CLOS-like object system, you can just use
class-of. Here’s a sample session in Racket, using Swindle:And similarly with Guile using GOOPS: