[plt-scheme] Combining two definition into one only

From: SamuelXiao (foolsmart2005 at gmail.com)
Date: Sun Oct 5 10:56:13 EDT 2008

I am a scheme newbie, could anyone tell me how can i combine this
following 2 definition into one?
(define insert-number
(lambda (new-element sorted)
(cond ((null? sorted) (list new-element))
((<= new-element (car sorted)) (cons new-element sorted))
(else (cons (car sorted) (insert-number new-element (cdr sorted)))))))

(define insertion-sort-numbers
(lambda (numbers)
(let helper ((unsorted numbers) ; The remaining unsorted values
(sorted '())) ; The sorted values
(if (null? unsorted)
(helper (cdr unsorted) (insert-number (car unsorted) sorted))))))

Posted on the users mailing list.