Yeah, this post is confusing. It reads as though I should expect `is` to be the same operator as `==`. But that's completely off. It's not that the integers are weird, it's that OP is misusing an operator. The topic could have been an explanation of what the `is` is, instead it's confusing and not helpful.
Despite a CS major, I still get confused about the meaning of |– vs. |=, and about the respective meta-syntactic levels of the variables used. Ironically, one issue for me is the lack of explicit typing in the notation itself.
He names references in his post. I highly doubt he’s confused about the difference between is and ==. It’s a weird leak of interpreter details that could, in very narrow situations, cause a bug.
> Also, speaking of notation, I wonder why you used ':=' instead of '=' to define 'f'. There is no computation going on, right?
In math, := is typically used to denote a definition. Using equality (=) only makes sense if both sides of the equality sign already have a definition.
> inequality x!=y is not used at all, because it is two chars. instead, we test with x-y, which holds true when operands differ
I think this is the line in the document that represents his coding style the most. Sacrificing legibility for plebs to save one character per comparison.
The author unfortunately has a misunderstanding of equality.
Quoting him, "The equal sign is another mathematical concept that’s often misunderstood. It means, of course, that whatever is on either side of the equal sign is equivalent." This is actually wrong.
The equals sign (=) is a shorthand for stating not that the two sides are equivalent, but that they are the same (i.e., they are equal).
If they were just equivalent, we would use another sign, like = (unicode U+2261).
Weirdly enough in mathematics it's far more common to define <= instead of <. With a<b simply being shorthand for 'a<=b and not b<=a'. The definitions also seem to be simpler that way.
He just decided to use "/=" rather than "|="...so it looks weird...
reply