[plt-scheme] htdp 22.2.2

From: wooks . (wookiz at hotmail.com)
Date: Wed Jul 19 11:22:25 EDT 2006


What should I be aiming for here...

I can get

(define (abs-Sort order)
  (local ((define (sort alon)
	    (foldl insert empty alon))
	  (define (insert an alon)
	      [(empty? alon) (list an)]
	      [else (cond
		      [(order an (first alon)) (cons an alon)]
		      [else (cons (first alon) (insert an (rest alon)))])])))

(define sortDesc (abs-Sort >))
(define sortAsc (abs-Sort <))
(sortAsc '( 2 3 1 5 4))
(sortDesc '(2 3 1 5 4))

...are there more abstractions I should be applying (say to insert for 

Posted on the users mailing list.