>>Here's an interesting piece :)
>>
>>Making Wrong Code Look Wrong -
http://www.joelonsoftware.com/articles/Wrong.html>
>Okay - I bookmarked for future reference (have some XSS issues coming up), but, the author referred to "Hungarian" notation. I have also heard reference to "reverse Polish notation" (BAL and CPM).
>
>Are "Hungarian" and "reversed Polish" a different reference to the same protocal?
Hungarian notation is a way you name and spell your variables and other named stuff in your code.
Polish notation comes from a certain guy named
Lukasiewicz (proper spelling probably Łukasiewicz; see also
this), which is (from what I remember of my Theory of Algorythms and Automata or Basics of Computing Machines courses from, um, 28 years ago) Operator(operand, operand2, ...). This was named Polish notation, since pretty much any Westerner would have trouble remembering his name (just like they could never pronounce Károly Simonyi with a proper ny, ly and s-as-sh). One language which is totally PN is lisp()... where the whole program can be written as one huge function :). I've seen Lisp code with about 12 levels of parentheses. And that was no obfuscation contest - it was in a Lisp textbook.
Now the RPN goes the opposite: operandN, operandNMinusOne... operand2 operand1 operator. Two programming languages which I have used, that work on RPN, are Forth and PostScript (you know the ugly little beast that resides in your laser printer?). The "special key" which pushes your operand on stack (oh yes, it can't live without a stack) is the space key. So if you want (in Forth) to print ?8+11, you do
11 8 + .
The dot is your "print" operator, and + is the operator which takes two operands off the stack, adds them, and leaves the result on the stack.
I've done some extensive PostScript coding last weekend, and believe me, it's fun... and frustrating at times. Of course, I'm generating most of the stuff from VFP (and then submitting to GhostScript to render into a .png), because the numbers to crunch therein come from a distant SQL server, and need to be further squeezed out of several SPT cursors... but in the end it gives me a nice on-the-fly bitmap from my data, in any resolution I may wish for. Here's a piece which draws rays of different length - about 5 pixels for each degree, 10 for each 5th degree and 16 for each 10th degree:
/rays {
/r exch def
0 1 359 {
dup
/len10 exch 10 mod def
/len5 exch 5 mod def
r 0 moveto
len10 0 eq { Rad2 r sub }
{ len5 0 eq { 10 } { 5 } ifelse } ifelse
0 rlineto
stroke
1 rotate
} for
} def
Note the ifelse block which executes the code in matching braces - the 2nd on stack if 3rd on stack is true, or 1st on stack if not :).
You'll love Fox more after this :)