You are looking at historical revision 40239 of this page. It may differ significantly from its current revision.

WARNING: this page is considered obsolete, as it contains information about old CHICKEN versions.

Regular define-record records don't support generalized set. This macro implements support for binding to srfi-17.

(define-syntax (define-gs-record x r c)
  (let ((type (cadr x))
        (fields (cddr x))
 (%begin (r 'begin))
 (%define-record (r 'define-record))
 (%define (r 'define))
 (%getter-with-setter (r 'getter-with-setter)))
    `(,%begin
      (,%define-record ,type ,@fields)
      ,@(map (lambda (f)
	(let* ((getter (string->symbol
			(string-append
			 (symbol->string 
			  (strip-syntax type))
			 "-"
			 (symbol->string 
			  (strip-syntax f)))))
	       (setter (string->symbol
			(string-append
			 (symbol->string
			  (strip-syntax getter))
			 "-set!"))))
	  (list %define getter (list %getter-with-setter getter setter))))
      fields))))
 

(define-gs-record test a b c)

now you can say

 (define t (make-test 1 2 3))
 (set! (test-a t) 'new-val)