This is the mail archive of the
guile@sourceware.cygnus.com
mailing list for the Guile project.
Re: printing types ?
- To: Dirk Herrmann <dirk at ida dot ing dot tu-bs dot de>
- Subject: Re: printing types ?
- From: Michael Livshin <mlivshin at bigfoot dot com>
- Date: 07 Mar 2000 16:13:43 +0200
- Cc: Han-Wen Nienhuys <hanwen at cs dot uu dot nl>, guile at sourceware dot cygnus dot com
- Organization: who? me?
- References: <Pine.LNX.4.21.0003071449110.25486-100000@marvin.ida.ing.tu-bs.de>
Dirk Herrmann <dirk@ida.ing.tu-bs.de> writes:
> On Tue, 7 Mar 2000, Han-Wen Nienhuys wrote:
>
> > is there a generic way to print types from within GUILE? eg.
> >
> > 1 => integer
> >
> > #t => boolean
> >
> > etc.?
>
> I don't think so.
I do think so. but you need GOOPS. oh, and it won't distinguish
pairs and lists, of course.
guile> (use-modules (oop goops))
guile> (class-of 1)
#<<class> <integer> 91d60>
guile> (class-of '(1 . 2))
#<<class> <pair> cb948>
guile> (class-of '(1 2))
#<<class> <pair> cb948>
it would probably be a good idea to implement some analog of CL's
`deftype', `typep' and `typecase', too.
> Best regards
> Dirk Herrmann
--mike
--
Roses are red,
Violets are blue,
I'm schizophrenic...
And I am too.