<table cellspacing="0" cellpadding="0" border="0" ><tr><td valign="top" style="font: inherit;">I know how to write a simple collector<br><br>(define collect-range<br> (lambda (min max)<br> (cons (min (cons max ' ())))))<br><br>But that will just return a list containing its two arguments. I want my function to be able produce results such as these.<br><br>(get range ' (3 7 5 1 2 4) collect-range) and it will return ' (1 7)<br><br>Ok so first off i have to define collect max. Which I do as follows<br><br> (define collect-max<br> (lambda (max)<br> max))<br><br>Next I have to define get max. Which is simply<br><br>(define get-max<br> (lambda (lst collector)<br> (cond ((null? lst) (collector 0))<br>
(else<br> (get-max (cdr lst)<br> (lambda (max)<br> (cond ((> (car lst) max)<br> (collector (car lst)))<br> (else<br> (collector max)))))))))<br><br>So the get max function will
be able to keep track of the highest number in the list. <br><br>I need a function that can keep track of both the highest AND the number lowest in the list. If anyone could help me out I'd greatly appreciate it. Thanks!<br></td></tr></table><br>