title: How do I sort a nested sequence in clojure?
body: <p>I have a nested map in which the keys are numbers as follows:</p>
  
  <pre><code>{:18 [Lan Yuhong 165 Happy Lane 345-4533], :33 [Man Yuhong 165 Happy Lane 345-4533], :3 [Tan Yuhong 165 Happy Lane 345-4533], :6 [Jan Yuhong 165 Happy Lane 345-4533], :5 [Han Yuhong 165 Happy Lane 345-4533], :7 [Fan Yuhong 165 Happy Lane 345-4533], :1 [Sue Jones 43 Rose Court Street 345-7867], :9 [John Smith 123 Here Street 456-4567]}
  </code></pre>
  
  <p>which I want to sort on the basis of the first entry (i.e., keys) as follows:</p>
  
  <pre><code>{:1 [Sue Jones 43 Rose Court Street 345-7867], :3 [Tan Yuhong 165 Happy Lane 345-4533], :5 [Han Yuhong 165 Happy Lane 345-4533], :6 [Jan Yuhong 165 Happy Lane 345-4533], :7 [Fan Yuhong 165 Happy Lane 345-4533], :9 [John Smith 123 Here Street 456-4567], :18 [Lan Yuhong 165 Happy Lane 345-4533], :33 [Man Yuhong 165 Happy Lane 345-4533]}
  </code></pre>
  
  <p>However, the first entry in each list is treated as a string instead of an integer and the <code>sort/sort-by</code>
  return a lexographically sorted list as follows. Please note that the mps is stored in the <code>new-map</code> variable in my program.</p>
  
  <pre><code>(do
      (into (sorted-map) new-map)
  )
  </code></pre>
  
  <p>The output is:</p>
  
  <pre><code>([1 Sue Jones 43 Rose Court Street 345-7867] [18 Lan Yuhong 165 Happy Lane 345-4533] [3 Tan Yuhong 165 Happy Lane 345-4533] [33 Man Yuhong 165 Happy Lane 345-4533] [5 Han Yuhong 165 Happy Lane 345-4533] [6 Jan Yuhong 165 Happy Lane 345-4533] [7 Fan Yuhong 165 Happy Lane 345-4533] [9 John Smith 123 Here Street 456-4567])
  </code></pre>
  
  <p>How can I do this without using any loops? I am trying to avoid the use of loops here. However, a recursive function would be okay.</p>