I want to parse logic implication `p->q`. What should I add to global_dict,
so that parse_expr parsed it?
I know, that SymPy doesn't have and Implication class. I will create it by
myself, but `global_dict = {'->': Implication}` doesn't work.
--
You received this message because you are subscr
On Fri, 18 Jun 2021 at 11:07, Paul Royik wrote:
> I want to parse logic implication `p->q`. What should I add to
> global_dict, so that parse_expr parsed it?
>
> I know, that SymPy doesn't have and Implication class. I will create it by
> myself, but `global_dict = {'->': Implication}` doesn't wo
parse_expr parses Python syntax. global_dict only tells it how to
handle names that are undefined, but a->b isn't valid Python syntax.
So the only way to do this would be to create a transformer function
that parses -> from the tokens and reorganizes it into an Implies
call.
This actually probably