3 ms·
So are array languages polish notation? +/!100 feels like the opposite way you'd write it in some kind of RPN concatenative language 100 ! [ + ] /
by LAC-Tech 5y ago
So are array languages polish notation?
+/!100
feels like the opposite way you'd write it in some kind of RPN concatenative language
100 ! [ + ] /
- Jtsummers 5y agoNot quite. + isn’t the last thing done (which it would be in Polish notation). Instead it’s done during the / operation. Polish notation would be lisp (or the notion most people have for lisp, special forms and macros break it up a bit).
- LAC-Tech 5y agoLisp is polish notation for trees of variable arity. hence all the parens - you need some way to group them. So in some K flavoured LISP I think it would be ((/ +) (! 100))
- CraigJPerry 5y agoYou read it strictly right to left, weird idea to me but it’s common in the array languages - j and APL do it this way too. I believe the reasoning is something like Iverson (or maybe Whitney) didn’t like the complexity of PEMDAS in maths so decided on this rule.
- razetime 5y agoIverson wanted consistent symbols and rules for math notation. So it's math first, then programming language next. Makes it extremely strong with describing algorithms, but gets a bit complicated for programming.
- tzs 5y agoIn Polish notation all the operators are prefix operators. In APL family languages there are infix operators and prefix operators. Prefix operators take as their operand the result of everything to their right. Infix operators take as one operand everything to their right and take as their other operand the first thing on their left.