"Joe Marshall picked the wrong way to generalize <=" is not a reason, historical or otherwise, for <= not being generalized to 0 or 1 arguments.
Carl Eastlund On Fri, Oct 28, 2011 at 1:01 PM, Joe Marshall <jmarsh...@alum.mit.edu> wrote: > To John: > The original poster was asking why the comparison operators do not generalize > downward to 1-ary and 0-ary versions. Upward generalization works. > > On Fri, Oct 28, 2011 at 9:31 AM, Arthur Nunes-Harwitt <a...@cs.rit.edu> wrote: >> Hi, >> >> That's the wrong question. > > Well, sort of. > >> Recall that (= x1 x2 x3 ... xn) means >> (x1 = x2) & (x2 = x3) & ... & (xn-1 = xn). > > Yes, but I was generalizing in a different way: > > (define (binary-add a b) (+ a b)) > (define (binary-multiply a b) (* a b)) > > (define (binary->nary op base-case) > (lambda args (fold-left op base-case args))) ; ***** > > (define add (binary->nary binary-add 0)) > (define multiply (binary->nary binary-multiply 1)) > > (The line with asterisks is because it is not specified whether OP is > left-associative or right-associative. Fortunately, add and multiply work > both ways.) > > -- > ~jrm _________________________________________________ For list-related administrative tasks: http://lists.racket-lang.org/listinfo/users