Closed librasteve closed 1 year ago
Actually, 6²²/₃₃
is already also supported in the RakuAST grammar. Note the use of superscript/subscript!
So I'd think the syntax 3<1/2>
won't be needed.
@lizmat - that's great, thanks for the info.
I am a bit unsure what "supported in the RakuAST grammar implies. I see that I can go:
say Q|6²²/₃₃|.AST.EVAL; #6.66667 (Rat)
Which is cool. But can I use 6²²/₃₃
as a 'bareword' where I would put a Numeric literal somehow?
Your subscript/superscript method is very neat, but also needs me to reach for unicode.
My original request was to have a <texas>
equivalent for mixed fractions so that I can enter a literal 6<22/33>
as opposed to mentally calculate (reaches for crag) <198/33>
to avoid unicode keyboard hassles.
But can I use 6²²/₃₃ as a 'bareword' where I would put a Numeric literal somehow?
Yes.
Your subscript/superscript method is very neat, but also needs me to reach for unicode.
I'm pretty sure people who use this feature, will be able to create shortcuts. In fact, for the Raku grammar, I'm considering changing the .raku
representation of Rat
s to use the 6²/₃
, so <20/3>.raku
would become 6²/₃
.
My original request was to have a
<texas>
equivalent
I'll see if this is feasible or not.
I'm considering changing the .raku representation of Rats to use the 6²/₃, so <20/3>.raku would become 6²/₃
https://github.com/rakudo/rakudo/pull/5466 implements just that
My original request was to have a
<texas>
equivalent for mixed fractions so that I can enter a literal6<22/33>
I know it's an extra two characters, but you can already do 6+ <22/33>
. I thought you could do 6+<22/33>
, but that doesn't currently work; I'm not sure if it could in 6.e, though.
Would 6+<22/33>
be close enough to 6<22/33>
to work as the texas equivalent?
@lizmat / @codesections - thanks for the thoughts.
I can go 6+ <2/3>
today ... and to be honest I think this needs something like 6<2/3> to be the literal format or bust
I am wary of changing the .raku ... my guess is that this (Rat literals) is a seldom used corner of the syntax and people are a bit surprised that <22/3> works
There's quite a lot of cognitive load when that gets connected to <>
allomorph behaviour, such as dd <s 2/3 1> #("s", RatStr.new(<2/3>, "2/3"), IntStr.new(1, "1"))
Now I have broken my own feature request since dd <s 6<2/3> 1>
is weird (boy this language syntax design is hard)
Probably simplest to just drop this request and enjoy the new superscript world!
dd <6_1/2>; #RatStr.new(30.5, "6_1/2")
XD
@librasteve
When you first posted the <6_1/2>
example, I thought that it was syntax for creating 6½
(and thus provided a solution of the sort you were looking for). But it's not; it's syntax for creating 31½
(that is, 61 / 2
).
Did you have the same confusion that I initially did, or were you posting it as an example of a WAT
/somewhat surprising syntax that doesn't do what you wanted?
@codesections
I (mistakenly) thought I had found a non-existent feature. In fact, I was confused in the way you say. Sure, '_' here is a no-op.
stet Probably simplest to just drop this request and enjoy the new superscript world!
I note from recent IRC chat that soon
sum univals: "3½" #3.5
will be supported in core raku - bravo!But since unicode is a pita to type, I would also like the following literal syntax to work:
3<1/2>
…
Mixed Fraction Info …