Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?

Sometime ago, there was a discussion on the Racket users list about an experimental version of define-record-type (R6RS records) which supports a shorthand notation for element access.

This extended version of define-record-type is available as an R6RS library.

Since Racket supports R6RS as one of it's languages, it's possible to use (dharmalab records define-record-type) from within programs written in the Racket language or the R6RS language.

To try the library out in Racket:

$ cd ~/scheme # Where '~/scheme' is the path to your Scheme libraries
$ git clone git://

Adjust your PLTCOLLECTS environment variable:

export PLTCOLLECTS=/usr/racket/collects:~/scheme

Put this in the DrRacket definitions window:


(import (rnrs)
        (dharmalab records define-record-type))

(define-record-type++ point
  (fields x y))

Run the program. Now in the interactions window:

> (define p0 (make-point 10 20))
> (is-point p0)
> p0.x
> p0.y
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment