Hi Nils.

I agree with you, but at the same time I wonder what would be wrong with
replacing
'!' → '.factorial()'

Best regards,

Guillermo

On Sun, 29 Nov 2020 at 22:02, 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/0f70ad8a-bf21-4352-a863-0b8d596e509cn%40googlegroups.com
> <https://groups.google.com/d/msgid/sage-support/0f70ad8a-bf21-4352-a863-0b8d596e509cn%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>

-- 
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/CANnG18_HN6QkQWFEjVzmF20bH2veMwHFiadt9WHwK6bP%3DbaqoA%40mail.gmail.com.

Reply via email to