mathstodon.xyz is one of the many independent Mastodon servers you can use to participate in the fediverse.
A Mastodon instance for maths people. We have LaTeX rendering in the web interface!

Server stats:

2.8K
active users

Puppy Pi

Hey are there any pre-existing well-used alternate syntaxes for closed/open bounding of intervals than [] and ()?

Namely for something that works better for computer languages (and math! and English!) that already use parentheses? XD

Eg, using <> for the open endpoints instead of ()?

And eg, using ".." instead of a comma, to avoid confusion with a List/Sequence literal?

@codepuppy

I'm not sure if <> is a good idea, after all we need them for condition checks and inequalities which are as important as intervals. (I also think it'll put as much of a burden on parser if we're talking programming languages). In math, we use them for inner products.

Parentheses and square brackets aren't as much of a problem as one might think. Conflicting notation very rarely shows up in proximity to one another or in a way that isn't immediately clarified by context. That's particularly true if we change the comma to ellipsis (...). Then there is no source of confusion with sequences as it would unambiguously refer to an interval. Finally, the interval notation is shorthand/syntactic sugar for {x : a < x <= b} or similar. So there's always the option of falling back on that.

I do think that it would be nice if the notation had a way of showing that open intervals don't actually hit the end points while closed intervals do.

@aksharvarma Thanks for talkings!! :D

Hmmm perhaps you're right! Context-free grammars are not obvious to me so I'll have to play with it to see if Antlr or similar can handle arbitrary expressions with that liiiike, hmm:

[a, b, (4*x .. f([32 .. (myInterval ++ (42 .. (j + 3)) ++ trailing))) ++ (x .. getMinBound(m ++ (y .. (j+1)]))), c]

(..I think I just popped a blood vessel lol]

(where "++" is a stand in for some interval operator, like concatenation or etc.)