On Mon, 2008-10-20 at 10:34 -0700, Ray Dillinger wrote:

> ;; be wary of bugs in this code; I am typing it from memory 
> ;; and have not tested it. 
> (define gencomp? (lambda (paircomp?)
>     (define comp? (lambda  arglist
>         (cond ((empty-list? arglist) #t)
>               ((empty-list? (cdr arglist) #t)
>               ((paircomp? (car arglist) (cadr arglist)) 
>                (comp? (cdr arglist)))
>               (else #f))))))

Sigh.  That'll teach me to trust my memory.  I shoulda wrote: 

;; be wary of bugs in this code; I am typing it from memory 
;; and have not tested it. 
(define gencomp? (lambda (paircomp?)
    (define comp? (lambda  arglist
        (cond ((empty-list? arglist) #t)
              ((empty-list? (cdr arglist) #t)
              ((paircomp? (car arglist) (cadr arglist)) 
               (comp? (cdr arglist)))
              (else #f))))
    comp?))


allows definition of all general comparisons as a function of the 
corresponding pairwise comparisons.  

                                Bear



_______________________________________________
r6rs-discuss mailing list
[email protected]
http://lists.r6rs.org/cgi-bin/mailman/listinfo/r6rs-discuss

Reply via email to