[racket] arity of + versus <=

From: Erich Rast (erich at snafu.de)
Date: Thu Oct 27 05:46:28 EDT 2011

Binary relations versus associative operations?

Subjective opinion: I'm not saying it couldn't be otherwise, but to me
the difference makes sense. At least (< 1) should always be an error in
my opinion. Regarding (< 1 2 3 4) as a shortcut for 1 < 2 < 3 < 4, well,
that's more debatable.


Best,

Erich


On Wed, 2011-10-26 at 20:32 -0700, Dan Grossman wrote:
> Very minor point, but is there a rationale beyond historical precedent
> for + and * to allow any number of arguments but, =, <=, <, >, >= to
> require at least two arguments?
> 
> It seems more uniform for the comparators to return #t when given 0 or
> 1 arguments rather than an error.
> 
> It would allow writing (apply < xs) instead of (or (null? xs) (null?
> (cdr xs)) (apply < xs)).
> 
> (Notice I left - out of the discussion.  Since - already has
> non-uniform behavior for 1 argument, it seems fine to raise an error
> for 0 arguments.)
> 
> (No, I don't really care about this detail.)
> 
> --Dan
> _________________________________________________
>   For list-related administrative tasks:
>   http://lists.racket-lang.org/listinfo/users




Posted on the users mailing list.