Don't have an account? Register now to chat, post, use our tools, and much more.
Latest Headlines
Online Users
There are 107 users online: 6 members, 69 guests and 32 bots. Members: don, Kllrnohj, matrefeytontias, shmibs. Bots: VoilaBot (3), Spinn3r (1), MSN/Bing (1), Magpie Crawler (4), VoilaBot (3), Googlebot (14), Googlebot (5), MSN/Bing (1).
RSS & Social Media
SAX
You must log in to view the SAX chat widget
|
| I love... |
| Prefix! (* 3 (+ 1 2)) |
|
27% |
[ 3 ] |
| Infix! (3 * (1 + 2)) |
|
27% |
[ 3 ] |
| Postfix! ((1 2 +) 3 *) |
|
0% |
[ 0 ] |
| RPN! (3 1 2 + *) |
|
27% |
[ 3 ] |
| I had never heard of these before. |
|
18% |
[ 2 ] |
|
| Total Votes : 11 |
|
| Author |
Message |
|
KermMartian

Site Admin

Joined: 14 Mar 2005 Posts: 55761 Location: Earth, Sol, Milky Way
|
|
| Back to top |
|
|
Ashbad

... I think redheaded girls are kind of cool

Joined: 01 Dec 2010 Posts: 2418 Location: Stomp Stomp Stomp, The Idiot Convention
|
Posted: 07 Nov 2011 11:28:21 pm Post subject: Re: Expression-Operator Ordering |
|
|
I can't wrap my mind around RPN well, but prefix notation seems fun and intuitive, in a sense, because I feel it's thinking more in terms of robust functions than just plain old operators. Of course, I'm best with infix notation, because I of course, learned it first, like virtually everyone else has. However, when you think about it, if you weren't used to it, it would seem a bit strange to put an operator between two numbers, rather than before or in a logical order of operations.
| KermMartian wrote: | | No one-word posts. |
Yes I do. _________________ -Ashbad |
|
| Back to top |
|
|
Qwerty.55
Expert

Joined: 08 Dec 2010 Posts: 613
|
Posted: 07 Nov 2011 11:30:15 pm Post subject: |
|
|
As much as I hate actually using RPN in real life, almost all of my programs involving equation parsing use RPN for the internal representations of functions. It minimizes the total characters in the representation string while remaining unambiguous, and ridiculously easy to convert to a syntax tree. For computers, it is the best expression ordering syntax. _________________ ∂²Ψ -(2m(V(x)-E)Ψ
----- = -------------
∂x² ℏ²Ψ |
|
| Back to top |
|
|
_player1537

Guru-in-Training

Joined: 25 Nov 2009 Posts: 2958
|
Posted: 07 Nov 2011 11:31:12 pm Post subject: |
|
|
Prefix, of course. I don't have any reasons except: it makes you think, and when you come back to it later, it's easier to tell what you meant. I would say that you don't have to include extra parentheses to make sure it interprets (3+2)*4 correctly, but the same statement in Scheme would be (* (+ 3 2) 4), which uses twice as many characters and even more spaces.
That said, I also enjoy RPN for a similar reason, it really pushes your mind to behave like a stack. When I was working on a stack-based programming language, just trying to wrap my head around code that would test the interpreter was extremely difficult.
Of course, infix notation is the easy one, but I find that I still add many spaces to make sure it looks good, and that I'll be able to read it later. _________________ http://tanner.myserverathome.com
 |
|
| Back to top |
|
|
christop

Power User

Joined: 09 Mar 2011 Posts: 385 Location: Arizona, USA
|
|
| Back to top |
|
|
|
Register to Join the Conversation
Have your own thoughts to add to this or any other topic? Want to ask a question, offer a suggestion, share your own programs and projects, upload a file to the file archives, get help with calculator and computer programming, or simply chat with like-minded coders and tech and calculator enthusiasts via the site-wide AJAX SAX widget? Registration for a free Cemetech account only takes a minute.
» Go to Registration page
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
© Copyright 2000-2013 Cemetech & Kerm Martian :: Page Execution Time: 0.031844 seconds.
|