[gambit-list] Incomplet and/or inkorrect implementation of SRFI-9
Bradley Lucier
lucier at math.purdue.edu
Fri Dec 1 18:26:13 EST 2006
On Dec 1, 2006, at 3:49 PM, Jeff Read wrote:
> 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)))))
Thanks, I changed define-macro to define-runtime-macro and put this
right into _nonstd.scm as
> [brad:~/programs/gambc-4.0b20/lib] lucier% rcsdiff -u _nonstd.scm
> ===================================================================
> RCS file: RCS/_nonstd.scm,v
> retrieving revision 1.1
> diff -u -r1.1 _nonstd.scm
> --- _nonstd.scm 2006/12/01 22:58:04 1.1
> +++ _nonstd.scm 2006/12/01 23:20:38
> @@ -998,10 +998,17 @@
> (##define-type-expand 'define-structure #f #f args))
> (define-runtime-macro (define-record-type name constructor
> predicate . fields)
> - `(define-type ,name
> - constructor: ,constructor
> - predicate: ,predicate
> - , at 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)))))
> +
> +
> ; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
> - - - - - -
More information about the Gambit-list
mailing list