[racket] Stuck on HtDP 25.2.6
#| 25.2.6
Develop a variant of quick-sort that uses only one comparison function, say,
<. Its partitioning step divides the given list alon into a list that
contains the items of alon smaller than (first alon) and another one with
those that are not smaller.
Use local to combine the functions into a single function. Then abstract the
new version to consume a list and a comparison function:
;; general-quick-sort : (X X -> bool) (list X) -> (list X)
(define (general-quick-sort a-predicate a-list) ...) |#
I've been stuck on this for over 90 minutes. Will someone please rephrase
the question or help me think about it a different way? I can't think of a
way to accomplish the sort using only one relational operator (<). Am I
reading it wrong? It sounds like I'm supposed to build two lists at the
same time and if a given input member is smaller than a threshold it goes in
one and if not it goes in the other. I can't wrap my head around how to
make that happen. I'm sure that if I could just hear the problem a
different way then I could make progress. There is some meaning in my head
that is out of sync with what's written that is blocking me from seeing how
to approach this problem. Thanks--
Luke
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.racket-lang.org/users/archive/attachments/20101025/ce5d4a3b/attachment.html>