Extra Recursion Problems, Using Lists of Spots
Extra 1: Filtering Out Spots Write a procedure, (spots-bound spots left top right bottom), that filters out all elements of spots which do not appear in the rectangle bounded at the left by left, at the top by top, at the right by right, and at the bottom by bottom. For example, if left is 5, top is 10, right is 8, and bottom is 20, the procedure should remove any spots whose column is less than 5 or more than 8 or whose row is less than 10 or more than 20.
Extra 4: Distances Between Spots Write a procedure, (spot-distances spots), that, given a list of spots, returns a list of the distance between neighboring spots in the list. For example, For example, > (define some-spots (list (spot-new 0 0 "red") (spot-new 10 0 "orange") (spot-new 10 8 "yellow") (spot-new 6 8 "green") (spot-new 6 5 "blue") (spot-new 9 9 "indigo") (spot-new 10 10 "violet"))) > (spot-distances some-spots) (10 8 4 3 5 1.4142135) Notice that spot-distances returns a list whose length is one less than the length of its input list.
Extra 6: Rendering Spots, Revisited Write (image-render-spots! image spots) without using map or for-each.