Blob


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.
7 (define (qsort alon)
8 (cond
9 [(empty? alon) empty]
10 [else (append (qsort )
11 (list (first alon))
12 (qsort (filter (lambda (x) (> x (first alon)))
13 (rest alon))))]))
15 qsort-filter : (number number -> boolean) number (listof numbers) -> (listof numbers)
16 Returns a (listof numbers) for all numbers in alon that when compared to anumber satisfies (filter number alon).
18 (define (filter-qsort operator anumber alon)
20 (filter (lambda (x) (< x (first alon)))
21 (rest alon))