Post Reply 
My own infix to prefix approach. What do you think?
04-17-2022, 01:42 AM
Post: #21
RE: My own infix to prefix approach. What do you think?
Not sure if that is still relevant for you after all these years …

(04-29-2014 12:47 AM)Matt Agajanian Wrote:  For example: (2+3)x(4+5) becomes x(+(2,3),+(4,5)).

In Lisp this is written:

(* (+ 2 3) (+ 4 5))

The function or operator is the first element in the list.
A space is used instead of the comma to separate their elements.

(04-30-2014 02:57 PM)HP67 Wrote:  What's neat about the Dijkstra algorithm is you can use it to generate numerous different kinds of outputs. You can create a postfix stream and since postfix doesn't have any order of operation ambiguity, you can actually evaluate the postfix stream as you're creating it and just output the result rather than the postfix.

Cf. Algebraic Operation System (AOS):
A program for the HP-41C that allows you to use the Algebraic Operating System (AOS) similar to how old Texas Instruments calculators work.
The shunting yard algorithm is used with a data and an operator stack.
Find all posts by this user
Quote this message in a reply
Post Reply 




User(s) browsing this thread: 1 Guest(s)