6 ms·
How would Pythagoras' formula look like in your language, because that has been my problem with stack based languages in the past. Great at doing high level abs
by DrDroop 2y ago
How would Pythagoras' formula look like in your language, because that has been my problem with stack based languages in the past. Great at doing high level abstract mathematical operations, fixed points and all of that jazz, but then it becomes impossible to read basic stuff without doing a dry run in your head.
- sfink 2y agoI have found that with some practice, stack-based is better for writing, infix is better for reading. At least for equations. Pythagoras is trivial to write: a a * b b * + sqrt and in fact the process of entering a calculation can be informative, since you are thinking about the sequence of operations more. Writing infix requires either looking ahead to figure out when to add parentheses, or backing up and adding them after the fact. But I still have to simulate bits and pieces in my head when reading postfix.