Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

It's been maybe 15 or so years, so I'm similarly pretty far down the rabbit hole, but I definitely remember having a lot of trouble with:

  x = x + 1
At the time, it seemed patently obvious that it was a false statement, because there is no single value of x for which this is true.

If the situations are analogous, my guess would be that you would assume that each of these statements is an assertion, and that at least one of them must be false. Intuitively, I'd guess that it's the last one that people would assume would be false, because as you're reading from top to bottom, you've already "accepted" the first two.



When teaching JavaScript to Kids about 10 years old. I tend to use x+=1 over x=x+1.

It seems to be much easier for people to attach the new construct += to to a new idea. I don't bring in the x=x+1 form until they have had plenty of use assigning other expressions to x. Kids don't seem to have any problem with x=y+1. They just need a little time for that idea to set properly before they start mixing things up.


X = infinity?


Depending on what you mean by "infinity", sure:

If you take it to mean "The cardinality of an infinite set", "X + 1" to mean "The set X with one more element added to it", and "X = Y" to mean "X and Y have the same cardinality", then "X = X + 1" is entirely true.

Mathematics, like programming, is ultimately founded on definitions.


I don't think infinity equals infinity. Not in the general mathematical sense anyway.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: