Hi Nils, fair enough. I didn't deeply think about it, my naive impression was that what the preparser does to R.<a,b> = QQ[] is at least as complicated as dealing with the exclamation mark. But I guess you're right: It isn't.
Best regards, Simon On 2020-11-29, Nils Bruin <nbr...@sfu.ca> wrote: > With the current regexp-based rewriting we'd need a pattern of the kind > '<argument>!' -> 'factorial(<argument)'. That will be very tricky to do. We > are doing an operator substitution already '^' -> '**" but that's very > basic and doesn't need any context. To change an implicit unary postfix > operator to an explicitly parenthesized prefix operator need almost > complete parsing. Had the factorial been explicitly parenthesized as well, > it would be a little easier, since now you could do it with parenthesis > counting -- still not regex territory, but possibly reasonably efficiently > done if one concentrates on the case where the expected string before the ! > is short. > > Insisting on parens does not satisfy the people who'd request this, I > imagine. Writing (5)! instead of 5! doesn't really do the trick. > > I consider this weird postfix notation as a peculiarity that works somewhat > OK in written math but, just as implicit multiplication, as bad in CAS use. > So I'm not in favour of it. I estimate that the number of arguments against > it is at least 3! > > On Sunday, November 29, 2020 at 5:32:30 AM UTC-8 Simon King wrote: > >> On 2020-11-29, Simon King <simon...@uni-jena.de> wrote: >> > Hi Emmanuel, >> > >> > On 2020-10-28, Emmanuel Charpentier <emanuel.c...@gmail.com> wrote: >> >> Nope. This syntactic sugar is provided by `Maxima`'s and >> `Mathematica`'s >> >> readers, but not by Sage preparser. >> > >> > Would it be nice (and easy) to have in Sage? What prevents the preparser >> > from understanding "!"? >> >> To be more precise: If I understand correctly, the preparser can be made >> to accept any syntax, provided that this syntax is in no conflict with >> valid Python syntax. >> >> There is a special meaning of "?" and "??" in Python, but I think there >> isn't a special meaning to "!". Sage accepts "!" at the beginning of a >> line, meaning that it executes a shell command, such as >> sage: !ls >> But it should be possible that the preparser could turn "(expression)!" >> into >> "gamma(expression+1)". >> >> Do people agree? Unfortunately I do not volonteer to implement it, I' >> not familiar with the innards of the preparser. >> >> Best regards, >> Simon >> >> > -- You received this message because you are subscribed to the Google Groups "sage-support" group. To unsubscribe from this group and stop receiving emails from it, send an email to sage-support+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/sage-support/rq12u7%244h1%241%40ciao.gmane.io.