It's funny to watch other (newer) developers reactions when they ask to borrow the calculator that's usually on my desk (a 42S) and then give it back several minutes later, with a puzzled look on their faces.
It's funny to watch other (newer) developers reactions when they ask to borrow the calculator that's usually on my desk (a 42S) and then give it back several minutes later, with a puzzled look on their faces.
-- HP calc owner
Last year I finally read the whole manual (as a teen I only used the symbolic differentiator, most useful and magical to my brain at the time). Since I learned about Lisp, so RPN programming features appealed to me. I realized that:
1) RPN has lambda << 2 + >> means (lambda (...) (+ 2 ...))
2) RPN has a short syntax for them << a -> a 2 + >>
Yes, 1990 HP RPN had arrow notation out of the box. Take that ES6 !
ps: there are some Chuck Moore talks on youtube that are worth gold. His CPUs are heaven
then https://www.youtube.com/results?search_query=chuck+moore+ga1...
https://www.youtube.com/watch?v=odBjuSCX8jE
and Kalny's videos https://www.youtube.com/watch?v=KSTjQA-iz4w
The syntax is slightly different. What it should be is this
<< -> a << a 2 + >> >>
The arrow introduces a binding form that captures the top n levels of the stack into n named local variables. (There's also a lower level implementation that forgoes the names in favor of a lookup-by-ordinal scheme that's a lot faster.)
The other notable difference from what you might expect is that the lexical environment is not captured:
Consider this function:
<< -> a << << a 2 + >> >> >>
What it returns is a function object that looks like this, except that 'a' is a local variable reference rather than the global variable reference it looks like:
<< a 2 + >>
Evaluating this results in an error, because while 'a' is represented as a local variable reference, the environment containing the local binding for 'a' is no longer available.
I just put out my hp49.. god how I love these things.
ps: I just found out the latest attempt I did last years was a var called REC = << -> U << U U EVAL >> >> .. pretty sure I was trying a fixpoint CPS factorial in RPN