title: Finding the occurence element in the list in racket
body: <p>Assume <code>(list "apple" "orange" "apple" "grape" "orange")</code>and produce <code>(list (list 2 "apple") (list 2 "orange") (list 1 "grape"))</code>.</p>
  
  <p>The most common fruit will occur first in the produced list.
  In the case of ties, order the tied pairs with the fruit in increasing alphabetical order.</p>
  
  <p>use abstract list function such as map,filter, foldr and quicksort in local. no recursion.</p>
  
  <p>i'm not sure how to do it without recursion.</p>
  
  <p>i wrote like this:</p>
  
  <pre><code>(define (function list)
     (cond
        [(empty? list) empty]
        [else
          (local
             (define (helper1 a b)
               (cond
                 [(equal? a b) a]
                 [else b]))
             (define T (foldr helper1 (first list) (rest list)))
             (define (count a)
               (cond
                 [(equal? a T) true]
                 [else false]))
             (define new-list (quicksort (length (filter count list)) &gt;))]
  </code></pre>