I am currently working on Structure Definitions and am hoping that I can get
some feedback through this mailing list on whether I am doing things
correctly or not.

*Exercise 6.4.3.*   Provide a structure definition and a data definition for
representing three-letter words. A word consists of letters, which we
represent with the symbols 'a through 'z.

Here is what I have come up with.

;; word : symbol -> symbol
;  produce a word with the letters it's made of.
;  word is a structure
;  (make-word first-letter second-letter third-letter)
;  where first-letter, second-letter, and third-letter are symbols 'a thru
z'

(define-struct word (first-letter second-letter third-letter))
(define cat (make-word 'c 'a 't))

Using the interactive prompt I can do the following:
> (word-first-letter cat)
'c
> (word-third-letter cat)
't
_________________________________________________
  For list-related administrative tasks:
  http://lists.racket-lang.org/listinfo/users

Reply via email to