[gambit-list] Incomplet and/or inkorrect implementation of SRFI-9
Jeff Read
bitwize at gmail.com
Fri Dec 1 15:49:58 EST 2006
Brad,
On 11/30/06, Bradley Lucier <lucier at math.purdue.edu> wrote:
>
> Do you have any quick suggestions about how to fix this?
>
Here's a hack I came up with:
(define-macro (define-record-type name constructor predicate . fields)
(let* ((te (string->symbol (string-append "type-exhibitor-"
(symbol->string name)))))
`(begin
(define-type ,name
constructor: ,constructor
predicate: ,predicate
type-exhibitor: ,te
, at fields)
(define ,name (,te)))))
Now:
> (define-record-type :pare
(kons x y)
pare?
(x kar set-kar!)
(y kdr))
> :pare
#<type #2 :pare>
Hope that helps.
--Jeff
More information about the Gambit-list
mailing list