# Re: OT Why Am I doing this?

Ken Tilton <kennytilton@xxxxxxxxxxxxx> writes:

My Algebra model sees the world as either unary or binary, so 1+2+3
cannot be (+ 1 2 3). Instead, I follow the associative thing and
encode the infix as (+ (+ 1 2) 3).

Can anyone tell me why I am encoding --42 as (- (- 42)) instead of (-
(-
42)?

- and + are overloaded, not generic.

(- x)

is not the degenerate case of

(- x y)

In fact, it's not even shorthand for

(- 0 x)

because of the issue that

(- 0.0)

must return -0.0, not 0.0 (if a representation for -0.0 is available).

Consequently, the reason you encode --42 as (- (- 42)) is the same reason
you encode f(f(x)) as (f (f x)).

Extra credit: which do you think is mathematically more honest?

--x is mathematically more honest as (- (- x)).

Now whether --3 is better as (- -3) or (- (- 3)), and whether -3 is better
as (- 3) or -3, that's harder to say.

I'll try googling sign+associative

I'll just note that your choice of search keyword biases the answer.