- Structures bundle several values into one.
- There exists a predefined structure called “posn”
- make-posn: Num Num Posn
- posn-x: Posn Num
- posn-y: Posn Num
- Generally used for positions.
- (make-posn 8 1) is considered to be a value and will not be simplified by the stepper.
Defining Structures and Data Definitions
- The define-struct function requires a structure name and a list of field names.
(define-struct mp3 (title artist))
- A structure definition should be followed by a data definition which defines the parameters of a structure.
;; An mp3 = (make-mp3 String String)
- Doing this creates a few functions for the user: