[r6rs-discuss] Comparison procedures' number of arguments

Ken Dickey Ken.Dickey at whidbey.com
Fri Oct 24 14:35:11 EDT 2008


On Friday 24 October 2008 11:07:25 David Van Horn wrote:
> Ken Dickey wrote:
> > I have not yet found a sorted? predicate used in an induction
> > loop.
>
> There is an implicit use here (adapted from HtDP), by appealing to fact
> that (sorted? null) is #t.
>
> (define (sort alon)
>    (cond
>      [(null? alon) null]
>      [else (insert (car alon) (sort (cdr alon)))]))
>
> David

No.  The induction is on the length of the list with the termination condition 
that the list is empty.  

If you substitute 'sorted? for 'null? you would be moving toward slow-sort, 
where the entire collection is sorted, the least element noted, the entire 
collection sorted again ...

;^)

-KenD




More information about the r6rs-discuss mailing list