[plt-scheme] create name with syntax-case

From: Marijn Schouten (hkBst) (hkBst at gentoo.org)
Date: Tue Jun 5 08:41:30 EDT 2007

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi list,

I would like to know how I should change the following snippet such that it
will define the 4 functions implementation->eval-command
implementation->interpret-command implementation->compile-command and
implementation->run-compiled-command.

(define-syntax define-accessor
  (lambda (x)
    (syntax-case ()
        ((_ field position)
         (define (implementation->field implementation)
           (let ((entry (hash-table-ref/default database implementation #f)))
             (if entry (vector-ref entry position) (error "no such
implementation known!"))))))))

(define-accessor eval-command 0)
(define-accessor interpret-command 1)
(define-accessor compile-command 2)
(define-accessor run-compiled-command 3)

Marijn
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.4 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFGZVn6p/VmCx0OL2wRAjeiAJ91QPwQX29cCX2T3L1Ogm+D9+L7PQCfd55D
WUjrfQN974/IN/eI98MdRbw=
=Xeb7
-----END PGP SIGNATURE-----


Posted on the users mailing list.