Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Recording calc commands (like macro, but editable)

46 views
Skip to first unread message

electricpete

unread,
Feb 4, 2012, 2:33:00 PM2/4/12
to
In excel vba, when we record a macro, the vba code gets recorded and
we can go back and edit it later using program editor to further
customize the program. This is a fantastic way for quickly/
effectively generating a program imo because it allows us to use the
native (excel) environment in the way we are used to with immediate
feedback as macro recording proceeds, rather than typing programming
commands in our editor without any feedback at all.

It would be great if same capability existed in HP48 or emu48. (Does
it?).
I was initially excited when I saw the macro record/play menu choices
in Emu48. Then when I played with them it generated a file with
extension "mac" that doesn't seem readable on anything other than the
emulator (for playback). I suspect my initial optimism was unfounded
and the programmers of this macro feature never implemented the
particular feature I'm describing. Correct?

Second thought: it occurs to me we might be able to do this in the
HP48 itself using RPL. We would have to create an application which
interacts with the user "normally", but also stashes each entered
command into an HP48 program variable. Has anyone done this?

John H Meyers

unread,
Feb 7, 2012, 5:20:24 AM2/7/12
to
On 2/4/2012 1:33 PM, electricpete wrote:

> I was initially excited when I saw the macro record/play menu choices
> in Emu48. Then when I played with them it generated a file with
> extension "mac" that doesn't seem readable on anything other than the
> emulator (for playback). I suspect my initial optimism was unfounded
> and the programmers of this macro feature never implemented the
> particular feature I'm describing. Correct?
>
> Second thought: it occurs to me we might be able to do this in the
> HP48 itself using RPL. We would have to create an application which
> interacts with the user "normally", but also stashes each entered
> command into an HP48 program variable. Has anyone done this?

I just type my program commands into an editor,
then transfer them to and run them on the emulator.

There are also "Vectored Enter" variables which can be
installed in the calculator to record what you do in the calculator
(e.g. can save all command lines and all keypresses), FWIW.

I've never used "Macro" yet -- your description doesn't make it sound
that inviting, but I suppose a sample of a ".mac" file might help,
as far as comprehending what it is. Or maybe there's some documentation,
which of course I never read :)

[r->] [OFF]

oliverue

unread,
Feb 7, 2012, 7:29:28 PM2/7/12
to
> ... it occurs to me we might be able to do this in the
> HP48 itself using RPL. We would have to create an application which
> interacts with the user "normally", but also stashes each entered
> command into an HP48 program variable. Has anyone done this?

FWIW, the ability you seek exists in ND1 (an iOS RPL calculator).
There're record and stop soft-keys in the Program menu.

This technique is, of course, limited to recording a sequence of
commands, when useful programs usually contain control structures
(IFs, FORs, DOs, etc.).

However, with list processing, IFT and IFTE, and an efficient way to
produce lists {1...n}, you can often replace IFs and FORs, and this
technique becomes really powerful for interactive program development,
where you see step-by-step what is happening to test data. A real
advantage of RPN in this: as you enter the test data before your first
command, you can opt to not record it, and thereby obtain a function
that will work with different input data, without editing.

An example to illustrate what I'm talking about:

Say you want to write a function that computes the sum of all perfect
squares up to a given number.

Steps:
- Enter 10 (stack: 10; this be the test
data)
- Press record
- Enter 1 (stack: 10, 1)
- Press SWAP (stack: 1, 10)
- Enter range (stack: [1 2 3 4 5 6 7 8 9 10])
- Enter [ √ FP 0 == ]
- Enter filter (stack: [1 4 9])
- Enter total (or ∑LIST) (stack: 14)
- Press stop

The stack will now contain your program: ≪ 1 SWAP [√ FP 0 ==] filter
total ≫

As you didn't record the test data (10), it will use as input
whatever's on the stack, when you run it. That is, it is the desired
function. (And you know it works, because you saw the intermediate
results and the final result, as you performed the steps.)

You store the function and run it on 10000. Result: 338350

The function replaces this more traditional RPL program, containing
FOR and IF structures (which cannot be recorded in principle):
≪ \-> n ≪
0
1 n FOR i
IF i √ FP 0 ==
THEN
i +
END
NEXT



More about array processing and recording is in the latter portion of
this: http://naivedesign.com/ND1/User_Functions.html

As an aside, with ND1 you can edit on your computer and run on your
iOS device a second later: http://naivedesign.com/ND1/Computer_Link.html
(This is actually quite a bit more convenient than an emulator (or so
I find).)

electricpete

unread,
Feb 7, 2012, 10:47:00 PM2/7/12
to
> I just type my program commands into an editor,
> then transfer them to and run them on the emulator.
You probably carry in your mind the status of the stack. Having the
stack displayed helps double-check the mental model, if nothing more
than how many items are on the stack. It is not a requirement, just a
convenience.

> There are also "Vectored Enter" variables which can be
> installed in the calculator to record what you do in the calculator
> (e.g. can save all command lines and all keypresses), FWIW.
Thanks. Google led me to a descriptoin (FAQ 8.12). That sounds like
exactly what I was looking for.

electricpete

unread,
Feb 7, 2012, 10:49:28 PM2/7/12
to
On Feb 7, 6:29 pm, oliverue <olive...@hotmail.com> wrote:
> FWIW, the ability you seek exists in ND1 (an iOS RPL calculator).
> There're record and stop soft-keys in the Program menu.
That looks like a great program. Unfortunately, I am using an Android
rather than an iPhone. If you put it on the Android platform, I think
I would buy it in a heartbeat.

oliverue

unread,
Feb 8, 2012, 5:09:30 AM2/8/12
to
Android will be supported. Working on it.

Already runs on Kindle on a 6" E-ink display, with 2-3 weeks of use
between charges and a huge display. Unfortunately, this cannot be
released yet. Amazon is highly selective about who they let make
apps...
0 new messages