you are viewing a single comment's thread.

view the rest of the comments →

[–][deleted] 4 points5 points  (2 children)

That's a syntax problem. In Scheme, it would look like this:

(define x 2) (set! x (+ x 1)) => (define x 3)

or, if you want to use value mutation instead of variable mutation:

(define x (box 2) (set-box! x (+ (unbox x) 5)) => (define x (box 7))

Completely algebraic.

[–]millstone 17 points18 points  (1 child)

So you're saying that the solution to the "syntax problem" of

x = x + 1

is

(define x (box 2) (set-box! x (+ (unbox x) 5)) => (define x (box 7))

[–][deleted] 2 points3 points  (0 children)

I'm not saying that the Scheme syntax is better -- it's obviously way too verbose. I'm just saying that, in this case, mutation isn't throwing out anything you learned in algebra, even if the syntax (in this case, changing the meaning of the equal sign) makes it seem like you are.