[plt-scheme] Re: Htdp chapter 12 insertion sort

wooks wookiz at hotmail.com
Tue Jun 2 15:07:06 EDT 2009



On Jun 2, 7:47 am, Marco Morazan <moraz... at gmail.com> wrote:
> > ;; sort : list-of-numbers  ->  list-of-numbers (sorted)
>
> > ;; to create a list of numbers with the same numbers as
> > ;; alon sorted in descending order
> > (define (sort alon)
>
> >   (cond
> >     [(empty? alon) empty]
> >     [(cons? alon) (insert (first alon) (sort (rest alon)))]))- what is cons?
> > alon here , is it required there?
>
> What exactly is bothering you? cons? is a primitive used to determine
> if its input is a constructed list.
>

Perhaps he is bothered by the use of cons? rather than  list?


More information about the plt-scheme mailing list