Scheme sorting a list

Posted by John on Stack Overflow See other posts from Stack Overflow or by John
Published on 2010-03-26T22:24:09Z Indexed on 2010/03/26 22:53 UTC
Read the original article Hit count: 364

Filed under:
|
|
|
|

Okay so I am trying to take in a list and sort it from greatest to smallest.

Example:
> (maxheap (list 5 6 2 1 18 7))
;output:
> (18 7 6 5 2 1)

So here's what I got so far:

(define (mkmaxheap heaplist)
  (let ((max (mymax(heaplist))))
  ;mymax is a func that returns max number, it works

    (let (( head (car heaplist)) (tail (cdr heaplist)))
      (if (null? tail)
         newlist))))

Thats all I could get to compile, all the other code I wrote failed. Any help on solving this would be much appreciated.

© Stack Overflow or respective owner

Related posts about Scheme

Related posts about homework