;;; Grader: Dale

;;; polygon-first-quadrant? : polygon -> boolean [1pt]
;;; Does the polygon lie entirely in the first quadrant of the plane? [1pt]

(define (polygon-first-quadrant? poly)
  ;; [2pt for COND]
  (cond [(empty? poly) true]    ; [1pt base case]

        ;; [1pt: AND; 1pt: natural recursion]
        [else (and (posn-first-quadrant?    (first poly))
                   (polygon-first-quadrant? (rest poly)))]))

;;; Alternate definition with more logic and less COND:
(define (polygon-first-quadrant? poly)
  (or (empty? poly)
      (and (posn-first-quadrant?    (first poly))
           (polygon-first-quadrant? (rest poly)))))


;;; [Allocate same 2pt total if this code is inlined above.]
;;; Posn -> Boolean [1pt]
;;; Is the given Posn in the first quadrant? 

(define (posn-first-quadrant? p) ;; [1pt]
  (and (<= 0 (posn-x p))
       (<= 0 (posn-y p))))


;;; Examples/Tests: [2pt]
(polygon-first-quadrant empty)
(polygon-first-quadrant (cons (make-posn 1 1) empty))
(not (polygon-first-quadrant (cons (make-posn 7 5) 
                                   (cons (make-posn 10 -4)
                                         (cons (make-posn -6 -6)
                                               empty)))))