News for hackers. Stuff that matters.
Re:Wall Street's Cult Calculator Turns 30 by sigil on Wednesday May 04, 2011 @02:40AM (#2512990)
Guess I'm a little too young for the 12c. I grew up on the 28S.

Concatenative languages like the HP RPN offer a nice gentle introduction to programming. In fact, I'll go further and say they trick you into programming without even realizing it. One minute you're working through a calculation for the Nth time via the same series of button presses, the next minute you're recording those button presses into a new user-defined button, and moving on to some higher level calculation. I've seen people do this and think they're "just calculating," when in fact they're doing bottom-up programming.

Here's an example if you're not familiar with HP RPN. Say you're performing a repetitive computation like finding the euclidean mean with X and Y already sitting on the stack. These are the buttons you push:

  DUP * SWAP DUP * + SQRT
You can turn this into a program by recording the same set of button presses, then giving it a name:

  << DUP * SWAP DUP * + SQRT >> 'L2NORM' STO
On the 28S and later calculators, there's a menu that holds stored programs. Now you just navigate to that menu and hit the button under 'L2NORM'.

This natural progression from calculation -> programming is something I miss in other languages. I like the idea of concatenative languages [1] like Factor, Joy and Forth, but hesitate to embark on anything more than trivial programming with them; their terseness can be even more extreme than Lisp's.

[1] http://concatenative.org/wiki/view/Front%20Page

There are no comments on this comment yet.