Post Reply 
Missing "WHEN" "IFTE"and "()?" ITEMs
06-05-2016, 10:45 PM (This post was last modified: 05-06-2021 04:04 PM by compsystems.)
Post: #1
Missing "WHEN" "IFTE"and "()?" ITEMs
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?
Find all posts by this user
Quote this message in a reply
06-06-2016, 06:32 AM
Post: #2
RE: missing "WHEN" ITEM
Hello,

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

Cyrille

Although I work for the HP calculator group, the views and opinions I post here are my own. I do not speak for HP.
Find all posts by this user
Quote this message in a reply
06-06-2016, 06:52 AM
Post: #3
RE: missing "WHEN" ITEM
(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?)
Find all posts by this user
Quote this message in a reply
06-06-2016, 02:19 PM
Post: #4
RE: missing "WHEN" "IFTE"and "()?" ITEMs
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-
Find all posts by this user
Quote this message in a reply
Post Reply 




User(s) browsing this thread: 1 Guest(s)