a4q1 - ; The first three lines of this file were inserted...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
;; The first three lines of this file were inserted by DrScheme. They record metadata ;; about the language level of this file in a form that our tools can easily process. #reader(lib "htdp-intermediate-lambda-reader.ss" "lang")((modname a4q1) (read-case- sensitive #t) (teachpacks ()) (htdp-settings #(#t constructor repeating-decimal #f #t none #f ()))) ;;CS 116 Assignment 4 Question 1 ;;r46wang 20319247 ;; closest: (listof posn)[nonempty] posn -> posn ;; to find the closest posn from the list of posns inputted to the posn inputted (in terms of euclidean distance). ;;Examples: ;;(closest (list (make-posn 0 0))(make-posn 100 100)) => (make-posn 0 0) ;;(closest (list (make-posn 0 0)(make-posn 50 50)(make-posn 150 150))(make-posn 100 100)) => (make-posn 50 50) ;;(closest (list (make-posn 200 200)(make-posn 100 100)(make-posn 10 10))(make-posn 0 0)) => (make-posn 10 10) ;;(closest (list (make-posn 0 1) (make-posn 10 -11) (make-posn 100 100)) (make-posn 95 98)) => (make-posn 100 100) (define (closest places reference)
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 10/21/2010 for the course CS 116 taught by Professor T.vasiga during the Fall '09 term at Waterloo.

Ask a homework question - tutors are online