News for hackers. Stuff that matters.
Re:Many elementary teachers don’t understand math, and it ma... by roenxi on Saturday November 30, 2019 @07:41AM (#21669705)
> But many elementary students don’t understand the meaning of the equal sign.

Some people might not have made the connection, but by and large programming languages make this mistake too. All the major ones are using the = glyph for assignment.

Re:Many elementary teachers don’t understand math, and it ma... by wrinklytidbits on Saturday November 30, 2019 @08:14AM (#21669819)
Languages like J make this distinction: `=` is equals in the mathematical sense [1], while `=.` and `=:` are the assignment operators (the former being local and the latter global) [2].

Although the assignment operator and the equals operator are similar there is a preference to have the equals sign retain its original meaning.

1. https://www.jsoftware.com/help/dictionary/d000.htm 2. https://www.jsoftware.com/help/dictionary/d001.htm

Re:Many elementary teachers don’t understand math, and it ma... by ken on Saturday November 30, 2019 @09:08AM (#21670005)
So do Pascal and Ada, but using "the = character with a tiny dot next to it" doesn't sound like it will avoid the fundamental issue here. That's just extra syntax to help remind the programmer whether they're assigning or comparing. It still basically looks like "=". That's why it was chosen.

(I wouldn't call J's = "the mathematical sense", either, as I don't know any mathematicians who would say that = is an operator that evaluates to 1 when the two sides are within 2⁻⁴⁴. The mathematical sense is merely a statement of fact, e.g., "x+10=y+10", when x is 5 and y is unknown, should mathematically result in knowing that y is also 5. Wolfram is the only language I know offhand that does anything like this.)

Forth, Lisp, Scheme, APL, R, Logo, Cobol, and assembly all have a variable assignment syntax that doesn't use the "=" character at all. Only 2 of them even use the form "varname SYMBOL expression".

I probably wouldn't recommend assembly language as a teaching language, but you have to admit no assembly programmer ever confused LDA and CMP.

Re:Many elementary teachers don’t understand math, and it ma... by purple-again on Saturday November 30, 2019 @09:00AM (#21669975)
What mistake is that? The left hand variable equals the right hand value assigned to it.

Foo = bar and 1 = 1 are equivalent in my mind.

Re:Many elementary teachers don’t understand math, and it ma... by ken on Saturday November 30, 2019 @09:51AM (#21670197)
The mistake is assuming "=" is a statement of fact (as in mathematics), rather than a request for assignment (as in programming).

Depending on which programming language you're using, "foo = bar" can mean either "make foo now equal to what bar is" or "is foo equal to bar now?". Neither one is the same as in mathematics, which is "foo is categorically equal to bar".

Consider:

    foo = 1
    bar = 2
    foo = bar
In mathematics, this would be a logical contradiction, and either you'd realize you made a mistake, or you'd jump back to the step where you said "now assume ..." and say "now we've proven this can't be true".

In programming, this is perfectly valid, and means "ok, ignore what I wrote just 2 lines ago, and now make foo equal to 2, also".

You say you think it means "the LH var equals the RH value assigned to it", but you don't say what you think it means to assign to the literal 1.

Re:Many elementary teachers don’t understand math, and it ma... by purple-again on Saturday November 30, 2019 @12:55PM (#21671200)
Thank you for your well thought out explanation! It is clear now and I was committing the cardinal sin of speaking generally while assuming context that was explicit only to my understanding of the situation. Have a great day!
Re:Many elementary teachers don’t understand math, and it ma... by pbhjpbhj on Saturday November 30, 2019 @09:24AM (#21670060)
So 2 = 1?

How do you square that circle, "fine" for assignment; wrong for equality.