[plt-scheme] How get name of structure

From: wwall (wwall at yandex.ru)
Date: Wed Apr 11 03:42:01 EDT 2007

Hello plt-scheme,
i have this code:

(define-structure structure1 (f1))
(define-structure structure2 (f1 f2))
(define x (make-structure1 1))
(define y (make-structure2 'a 'b))

(define (f x)
(display (format "Name of  structure ~a \n" (??? x))))

;call f
(f x)
(f y)
want what will be printed
"Name of  structure structure1"
"Name of  structure structure2"

what i must write on place "???"
now i write so
(define (??? x) (string->symbol (substring (symbol->string (vector-ref (struct->vector   x) 0) ) 12)) )
but think what exists simply method

Best regards,
 wwall                          mailto:wwall at yandex.ru

Posted on the users mailing list.