0
;; makeRectangle -- constructor for 'rectangle

(define makeRectangle
  (lambda (x0 y0 x1 y1)
       (makeGraph 'rectangle
               (list (makePoint x0 y0)
                     (makePoint x1 y1)))))

(makeRectangle 3 2 1 7)戻る必要があり、 or(rectangle (point 1 7) (point 3 2)) に対して同じ戻り値が得られます。次を使用する必要があります。(makeRectangle 1 2 3 7)(makeRectangle 1 7 3 2)

min x0 x1 min y0 y1 
max x0 x1 max y0 y1

しかし、私はどうすればよいかわかりません。この問題について教えてください。前もって感謝します。

4

1 に答える 1

1

次のような意味ですか。

(define makeRectangle
  (lambda (x0 y0 x1 y1)
    (makeGraph 'rectangle
               (makePoint (min x0 x1) (max y0 y1))
               (makePoint (max x0 x1) (min y0 y1)))))

そのような

-> (makeRectangle 3 2 1 7)
'(rectangle (point 1 7) (point 3 2))

-> (makeRectangle 1 2 3 7) 
'(rectangle (point 1 7) (point 3 2))

-> (makeRectangle 1 7 3 2) 
'(rectangle (point 1 7) (point 3 2))

-> (makeRectangle 3 7 1 2)
'(rectangle (point 1 7) (point 3 2))
于 2013-10-07T15:46:25.857 に答える