HP Forums
Missing "WHEN" "IFTE"and "()?" ITEMs - Printable Version

+- HP Forums (https://www.hpmuseum.org/forum)
+-- Forum: HP Calculators (and very old HP Computers) (/forum-3.html)
+--- Forum: HP Prime (/forum-5.html)
+--- Thread: Missing "WHEN" "IFTE"and "()?" ITEMs (/thread-6358.html)



Missing "WHEN" "IFTE"and "()?" ITEMs - compsystems - 06-05-2016 10:45 PM

Hello

Within the program editor, why is not the WHEN, IFTE and ()? ITEM, on TMPLT/2:BRANCH menu?
Note: IFTE is not synonymous with WHEN or ()? cmds

WHEN cmd

PHP Code:
#cas
test_whencmd_cas(testvar):=
begin
    
return whentestvartruefalse );
end;
#end 

test_whencmd_cas(true); [enter] returns true
test_whencmd_cas(false); [enter] returns false
purge(x); test_whencmd_cas(x); [enter] returns ((x)? true : false)
// if the test is symbolic, it returns
test_whencmd_cas(1); test_whencmd_cas(0); test_whencmd_cas(-1);
[enter] returns true,false,true


with (?) infix operator
PHP Code:
#cas
test_questionmarkcmd_cas(testvar):=
begin
    
return (testvar)? true:false;
end;
#end 

test_questionmarkcmd_cas(1); test_questionmarkcmd_cas(0); test_questionmarkcmd_cas(-1);
[enter] returns true, false, true

test_questionmarcmd_cas(x); [enter] returns ((x)? true : false)

with IFTE cmd, the test must always return a numerical value
PHP Code:
#cas
test_iftecmd_cas(testvar):=
begin
    
return iftetestvartruefalse );
end

test_iftecmd_cas(1); test_iftecmd_cas(0); test_iftecmd_cas(-1);test_iftecmd_cas(true); test_iftecmd_cas(false);
[enter]
1,0,1,1,0

test_iftecmd_cas(x); [enter] IFTE(x,1,0)

ifte + := operator
ifte(true,(testvar1:=123),(testvar2:=456)); [enter] returns 123 ok [up] [up] [copy] [enter] ok
ifte(false,(testvar1:=123),(testvar2:=456)); [enter] returns 456 ok
purge(testvar1, testvar2);

ifte + => operator
(true)? (123=>testvar1): (456=>testvar2); [enter] returns 123 ok,
(false)? (123=>testvar1): (456=>testvar2); [enter] returns 456 ok, but [up] [up][copy] [enter]
"sto 123:testvar4 not allowed! Error: Bad Argument Type"
Cause of the problem: the parentheses are suppressed in the arguments (123=>testvar3) to 123=>testvar3, this means that it cannot be interpreted

PHP Code:
#cas
test_questionmark2cmd_cas(testvar):=
begin
    
return (true)? (123=>testvar1): (456=>testvar2);
end;
#end 
purge(x);
test_questionmark2cmd_cas(x) [enter] returns 123, Why?


RE: missing "WHEN" ITEM - cyrille de brébisson - 06-06-2016 06:32 AM

Hello,

It's probably because the WHERE symbol (|) is accessible through the "template" key (left of the xtn key)

Cyrille


RE: missing "WHEN" ITEM - Wes Loewer - 06-06-2016 06:52 AM

(06-05-2016 10:45 PM)compsystems Wrote:  within the program editor, why is not the WHEN ITEM, on BRANCH menu ?

Or perhaps IFTE should be on the BRANCH menu instead. It looks like when might be the CAS version of IFTE. (Is this correct?)


RE: missing "WHEN" "IFTE"and "()?" ITEMs - DrD - 06-06-2016 02:19 PM

There is no doubt that the state of the Prime can be improved. In general, things like a full suite of the commands related to the sub-menus, such as the "Branch" list, are probably more of an attempt to {get} a suggestion list, than a complete listing resource. Those menus generally haven't included CAS commands, such as the when() command, but notably missing is the similar IFTE(). That is just the way it is, for now. Personally, I would rather have the developers prioritize the "add, move, change" features, and let the dictates of time/resources clear that resulting list.

It's always a good thing to report problems, and suggestions for enhancements can't hurt, but at some point, realization that this device has growing pains is going to have to include some room for user tolerance, or it will drive you nuts. Its widely known that documentation is weak. Parisse is entirely correct, sometimes, through no fault of his, the documentation is at variance, or lacking,with respect to the operation under scrutiny.

I appreciate the dedication those developer folks have shown. How much longer will this product cycle endure?

-Dale-