好的,我试图列入清单并从最大到最小排序。计划整理清单
Example:
> (maxheap (list 5 6 2 1 18 7))
;output:
> (18 7 6 5 2 1)
因此,这里是我走到这一步:
(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))))
这就是所有我能得到编译,其他所有的代码我写失败。任何帮助解决这个将不胜感激。