[r6rs-discuss] Comparison procedures' number of arguments

Elf elf at ephemeral.net
Mon Oct 27 07:58:08 EDT 2008


On Wed, 22 Oct 2008, Thomas Lord wrote:

> Elf wrote:
>> 
>>  meaning < and > have the same result.
>> this is, of course, impossible.
>
> I do not think that word means what you think
> it means.  ("impossible").
>
> -t
>

fair nuff, i spoke prematurely.

that said, after reading more of the discussion, i am convinced that the 
single param comparison procedures should return #t (due to the recurrence
into (AND (comparison? x[n] x[n+1]) ...) demonstrated by aziz and others),
but that the zero param comparison procedures should signal errors.  if the
single arg case is the null case of AND, what would the zero arg case be?

; ... < is a binary relation below

(define (less-than arg . rest)
     (if (null? rest)
         #t
         (and (< arg (car rest))
              (apply less-than rest))))


this is the simplest recursion that i could think up off the top of my head
for an unlimited maximum arity comparison proc.  a single arg is a clear stop
condition for the recursion and follows the convention for AND, around which
it is based.  where would a zero arg case fit into this?

-elf

demonstration using AND by aziz and others)



More information about the r6rs-discuss mailing list