Post Reply 
missing "WHEN" "IFTE"and "()?" ITEMs
06-05-2016, 10:45 PM (This post was last modified: 02-16-2020 10:50 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?
IFTE is not synonymous with WHEN or ()? cmds

WHEN cmd
Code:

#cas
prg0(test):=
  BEGIN
    return when(test,true,false);
  END;
#end

prg0(true) [enter] returns 1 on old firmware. true (new firmware) ok, thanks hpprime team
prg0(false) [enter] returns 0 on old firmware. false (new firmware) ok

prg0(1) -> true
prg0(0) -> false
prg0(-1) -> true
prg0(x1) -> ((x1)? true : false) // ok, If the test is symbolic, the input value in the output expression is replaced


with (?) infix operator
Code:

#cas
prg1(test):=
  BEGIN
    return (test)? true:false;
  END;
#end

prg1(true),prg1(false),prg1(1),prg1(0),prg1(-1) [enter] returns
true,false,true,false,true
prg1(x1) [enter] returns ((x1)? true : false) // ok, If the test is symbolic, the input value in the output expression is replaced


with IFTE cmd, the test must always return a numerical value
Code:

#cas
prg2(test):=
  BEGIN
    return ifte(test,true,false);
  END;
#end

prg2(true),prg2(false),prg2(1),prg2(0),prg2(-1) [enter] returns
1,0,1,0,1 // ok
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
02-16-2020, 10:52 PM (This post was last modified: 02-16-2020 11:04 PM by compsystems.)
Post: #5
RE: missing "WHEN" "IFTE"and "()?" ITEMs
ifte(true,(var1:=123),(var2:=456)) [enter] returns 123 ok [up] [up] [copy] [enter] ok
ifte(false,(var1:=123),(var2:=456)) [enter] returns 456
(false)? (123=>var3): (456=>var4) [enter] returns 456 ok, but [up] [up] [copy] [enter] error, Cause of the problem: parentheses are suppressed on the args
(false)? 123=>var3: 456=>var4

https://tiplanet.org/forum/portal.php
Find all posts by this user
Quote this message in a reply
Post Reply 




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