[racket] Redefining selectors - another newbie question

From: Noel Welsh (noelwelsh at gmail.com)
Date: Thu Jul 1 10:51:16 EDT 2010

This is fairly easy, but do you really want to avoid typing '-'?  I
think what you want is this:


(struct point (x y))

(define pt (point 1 2))

Currently, you write:

(point-x pt)

You want to write:




On Thu, Jul 1, 2010 at 3:35 PM, Brad Long <brad at longbrothers.net> wrote:
> Thankyou racket gurus for your advice. My program using a "loop" now works:
> (for-each (fn(x)(display x)(newline)) (.. 10 1)) (display "blastoff!")
> --
> I have another question, is it possible (preferably easy) to use dot
> notation for the auto-generated selectors (e.g. for (point x y z), instead
> of point-x can we use point.x)? I am not exactly sure how to redefine that
> since it is auto-created on construction of the struct.
> I have just donned my flame-proof clothing.
> Thanks.

Posted on the users mailing list.