How to make an ascending list in Racket?

Viewed 29

I merge two lists into one in Racket. Here the code:

(define (merge-tail l1 l2) 
  (cond 
    [(empty? l1) l2] 
    [(empty? l2) l1] 
    [(cons (car l1) (merge-tail l2 (cdr l1)))]))

The result is correct. For example '(15 8 42) '(24 54 7) --> '(15 24 8 54 42 7).

I want to make the result in ascending order. How can I do that?

0 Answers
Related