Representation of line segments on the plane.
Consider the problem of representing line segments in a plane. Each segment is represented as a pair of points: a starting point and an ending point. Define a constructor
that define the representation of segments in terms of points. Furthermore, a point can be represented as a pair of numbers: the
coordinate and the
coordinate. Accordingly, specify a constructor
that define this representation. Finally, using your selectors and constructors, define a procedure
that takes a line segment as argument and returns its midpoint (the point whose coordinates are the average of the coordinates of the endpoints). To try your procedures, you'll need a way to print points:
(define (print-point p) (newline) (display "(") (display (x-point p)) (display ",") (display (y-point p)) (display ")"))