Suggestion to extend tests for Free42
#1

Hi Thomas,

I have a suggestion regarding HP42s tests (like X=0?, x>y? and so on). How about allowing the test to execute a subsequent "BLOCK" or statement that appears after the test, if the test is true, or skip that block if teh test is flase. The block is enclose by { and }. The open brace appears right after the test.

Here is an example:

2
STO 00
0.01
STO 01
RCL 00
ABS
1
X>Y?
{
RCL 00
STO* 01
}
<more commands here>

If the test X>Y? is true then the processor executes the block of commands (RCL 00 and STO* 01 that are in the block that appears after the test. If the tested condition is false the processor skips the block altogether. Of course a block MAY contain other tests with their own blocks, so there should be a counter to detect the appropriate }.

Namir

#2

I'm not a big fan of that type of feature, I must admit. It seems like syntactic sugar that doesn't make anything easier that wasn't pretty easy to begin with.


My solution to skipping a block of instructions is usually to set aside a small number of labels for short-range forward-only jumps (so you can reuse them over and over within the same program), and then use X<=Y? GTO 00 RCL 00 STO* 01 LBL 00 (in your example; note that the sense of the test has been reversed). I think this has actually been HP recommended practice for a long time -- I seem to remember reading this in the HP-19C manual, or maybe it was the HP-41C manual? I personally think it's adequate.



Possibly Related Threads…
Thread Author Replies Views Last Post
  Prime Connectivity Kit Suggestion toml_12953 1 1,598 12-06-2013, 10:41 PM
Last Post: Michael de Estrada
  HP Prime suggestion to avoid Numeric/Symbolic confusion Chris Pem10 4 1,815 11-19-2013, 05:49 AM
Last Post: bluesun08
  HP Prime - Revision Suggestion - Setting the Clock Bill Triplett 5 2,099 11-15-2013, 12:36 AM
Last Post: Joe Horn
  HP Prime - Cross product suggestion bluesun08 13 4,468 11-08-2013, 01:49 AM
Last Post: Patrice
  HP Prime Emulator/Conn. kit suggestion Han 2 1,452 09-27-2013, 11:23 AM
Last Post: Han
  WP-34s feature suggestion: "Follow jump" shortcut Andrew Nikitin 3 1,473 06-12-2013, 01:42 AM
Last Post: Walter B
  [WP34S] A suggestion about C(x,y) Eduardo Duenez 15 3,943 01-28-2013, 04:50 AM
Last Post: Walter B
  The latest version of Free42 is now a OS X Universal application..... zeno333 1 991 10-21-2012, 11:12 PM
Last Post: Matt Agajanian
  I need the last OS X "Universal" version of Free42..... zeno333 0 843 10-13-2012, 04:45 PM
Last Post: zeno333
  An old trick rediscovered: combining conditional tests Dieter 2 1,298 08-12-2012, 03:42 PM
Last Post: Dieter

Forum Jump: