functional programming - Min Max Scheme coord.x0 y0 x1 y1 -


;; makerectangle -- constructor 'rectangle  (define makerectangle   (lambda (x0 y0 x1 y1)        (makegraph 'rectangle                (list (makepoint x0 y0)                      (makepoint x1 y1))))) 

(makerectangle 3 2 1 7) must return (rectangle (point 1 7) (point 3 2)) , same return (makerectangle 1 2 3 7) or (makerectangle 1 7 3 2), have use:

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

but don't know how do. please me issue? in advance.

do mean like:

(define makerectangle   (lambda (x0 y0 x1 y1)     (makegraph 'rectangle                (makepoint (min x0 x1) (max y0 y1))                (makepoint (max x0 x1) (min y0 y1))))) 

such as

-> (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)) 

Comments

Popular posts from this blog

java.util.scanner - How to read and add only numbers to array from a text file -

rewrite - Trouble with Wordpress multiple custom querystrings -