All pastes #187391 Raw Edit

Anonymous

public text v1 · immutable
·published 2006-10-01 01:33 UTC
rendered paste body
;; question 3

;; on-line : number number list -> list
;; returns a list of posns whose x and y
;; values satisfy the equation y=ax+b
;; from given numbers a and b and a
;; given list of posns
(define (on-line a b plist)
  (cond
    [(empty? plist) empty]
    [else (cond
            [(= (posn-y (first plist)) (+ (* a (posn-x (first plist))) b))
             (cons (first plist) (on-line a b (rest plist)))]
            [else (on-line a b (rest plist))])]))