[r6rs-discuss] On the arity of comparators
Ray Dillinger
bear at sonic.net
Mon Oct 20 13:34:28 EDT 2008
ISTR that several lisp dialects have had comparators that accept
zero or more arguments. In those cases the 0 and 1 argument cases
of comparators have, IIRC, been considered TRUE.
It has to do with a recursive implementation where the zero-argument
or single-argument case is the base case.
;; 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))))))
allows definition of all general comparisons as a function of the
corresponding pairwise comparisons. I remember being somewhat
surprised when I saw the arity requirements in R4RS.
Bear
More information about the r6rs-discuss
mailing list