1 ;; The first three lines of this file were inserted by DrScheme. They record metadata
2 ;; about the language level of this file in a form that our tools can easily process.
3 #reader(lib "htdp-intermediate-lambda-reader.ss" "lang")((modname |26.3|) (read-case-sensitive #t) (teachpacks ((lib "draw.ss" "teachpack" "htdp") (lib "arrow.ss" "teachpack" "htdp") (lib "gui.ss" "teachpack" "htdp"))) (htdp-settings #(#t constructor repeating-decimal #f #t none #f ((lib "draw.ss" "teachpack" "htdp") (lib "arrow.ss" "teachpack" "htdp") (lib "gui.ss" "teachpack" "htdp")))))
4 ;qsort : (listof number) -> (listof number)
5 ;Uses generative recursion to quickly sort alon.
10 [else (append (qsort (filter (lambda (x) (< x (first alon)))
13 (qsort (filter (lambda (x) (> x (first alon)))
16 qsort-filter : (number number -> boolean) number (listof numbers) -> (listof numbers)
17 Returns a (listof numbers) for all numbers in alon that when compared to anumber satisfies (filter number alon).
19 (define (filter-qsort operator anumber alon)
21 (filter (lambda (x) (< x (first alon)))