True. It gets ambiguous when doing n*(-(x + y)) i.e. n x y + - * (fail). The simplest solution is n 0 x y + - *
I can't actually think of any other unary operators. On Fri, Apr 2, 2021 at 10:54 AM Richard Damon <rich...@damon-family.org> wrote: > > One problem with trying to mix RPN with in-fix is that some operators, > like - can be either a unary or binary operation in the in-fix > notations, distinguished by context. In RPN you have lost that context. > > is x y - - the same as -(x-y) or is it x-(-y) ? or is it waiting for > another operator and be x ?? (-(-y)) or is it expecting a previous > operand and is ?? - (x-y) > > (same with +) > > Typical RPN systems get around this by having unary - be a different > symbol/key that binary - > > -- > Richard Damon > > _______________________________________________ > Python-ideas mailing list -- python-ideas@python.org > To unsubscribe send an email to python-ideas-le...@python.org > https://mail.python.org/mailman3/lists/python-ideas.python.org/ > Message archived at > https://mail.python.org/archives/list/python-ideas@python.org/message/LX5T33N6IU6IMDKXU4KQMA2RP6U627CG/ > Code of Conduct: http://python.org/psf/codeofconduct/ _______________________________________________ Python-ideas mailing list -- python-ideas@python.org To unsubscribe send an email to python-ideas-le...@python.org https://mail.python.org/mailman3/lists/python-ideas.python.org/ Message archived at https://mail.python.org/archives/list/python-ideas@python.org/message/IWWAZGFYOXEBPHZLEKXW6UYADMDCNUPC/ Code of Conduct: http://python.org/psf/codeofconduct/