News for hackers. Stuff that matters.
Re:Don't use the greater than sign in programming by yitchelle on Monday February 22, 2016 @06:39AM (#11150120)
When someone says that, I always get confuse as to whether you meant an inclusive or an exclusive between. I think the mathematicians uses the square brackets to indicate that intention.
Re:Don't use the greater than sign in programming by Freak_NL on Monday February 22, 2016 @07:47AM (#11150425)
That is exactly why we have <, <= (≤), >, and >= (≥) in programming languages. It is a lot less verbose than saying exclusiveBetween(x, 5, 10).
Re:Don't use the greater than sign in programming by Shengbo on Monday February 22, 2016 @08:06AM (#11150508)
That could actually be an interesting linguistics problem. In spoken languages, "between" is usually inclusive unless context suggests otherwise. It can easily be a source of misunderstanding if the context clues are insufficient or the recipient has trouble picking up on them. I wonder if there are any languages that have different words for inclusive/exclusive "between" so people don't have to rely on implicit clues.
Re:Don't use the greater than sign in programming by mc808 on Monday February 22, 2016 @08:41AM (#11150688)
One possible convention would be to use "in-between" for the exclusive between. It's probably impossible to convince the whole English-speaking world to adopt it, but it would be more natural than "exclusive between" in code.
Re:Don't use the greater than sign in programming by agentultra on Monday February 22, 2016 @09:49AM (#11151081)
There are a few notations for intervals in maths; https://en.wikipedia.org/wiki/Interval_%28mathematics%29

There are arithmetic operators for intervals and IEEE standards! https://en.wikipedia.org/wiki/Interval_arithmetic#Elementary...

Re:Don't use the greater than sign in programming by TheAndruu on Monday February 22, 2016 @08:45AM (#11150710)
Agree. Perhaps it be better-named 'betweenInclusive(firstValue, secondValue)' and 'betweenExclusive(firstValue, secondValue)'