Function "contains" in HOME and CAS

01022018, 03:15 PM
Post: #1




Function "contains" in HOME and CAS
I've found a different behavior of the function "contents" in HOME and CAS, in the following situation:
L1:={"A","B"} In CAS contains(L1,"A") > 1 contains(L1,"B") > 2 In HOME contains(L1,"A") > 0 !!! contains(L1,"B") > 0 !!! 

01022018, 03:18 PM
Post: #2




RE: Function "contains" in HOME and CAS
its name is in lowercase, so I think it should be only a CAS command (not Home)...
∫aL√0mic (IT9CLU) :: HP Prime 50g 41CX 71b 42s 39s 35s 12C 15C  DM42, DM41X  WP34s Prime Soft. Lib 

01022018, 03:27 PM
Post: #3




RE: Function "contains" in HOME and CAS  
01022018, 03:29 PM
Post: #4




RE: Function "contains" in HOME and CAS
The lower case [CAS] command can work the same way in [Home] if you provide a CAS wrapper:
[CAS] contains(L1,"A"); ==> 1 [Home] CAS(contains(L1,"A")); ==> 1 

01022018, 06:18 PM
(This post was last modified: 01022018 06:22 PM by JMB.)
Post: #5




RE: Function "contains" in HOME and CAS
Ok, I realize that the safe way to execute a CAS function in HOME is to use the structure CAS(CAS_function).
What still bothers me is that you can use the CAS function directly in HOME and, depending on the arguments, get correct or incorrect results. As I said before, when L1 contains numbers instead of strings "contains" works correctly both in HOME and CAS. 

01022018, 06:32 PM
Post: #6




RE: Function "contains" in HOME and CAS  
01082018, 06:10 AM
Post: #7




RE: Function "contains" in HOME and CAS
Hello,
home contains(L1, "A") will cause A to be parsed as a CAS command line before the switch to CAS mode and the execution of contains. Assuming that the var A contains 0, what you execute is: contains(L1,0). CAS(contains(L1,"A")) will not cause a parse of the string. Subtelties of HOME/CAS interraction :) 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. 

01082018, 07:00 AM
Post: #8




RE: Function "contains" in HOME and CAS  
01082018, 07:56 AM
(This post was last modified: 01082018 07:57 AM by Carlos295pz.)
Post: #9




RE: Function "contains" in HOME and CAS
It is as indicated by Cyrille, it is due to the topic of Home/CAS interaction, since strings are interpreted by using CAS commands such as contains, head, solve, etc. (similar post http://www.hpmuseum.org/forum/thread8149.html)
It can be said that all CAS functions (~ lowercase commands) will present this interpretation of a string data. This article Home/CASSpanish may be useful. Correct use under this consideration: CAS(contains(L1,"A")) contains(L1,("A")) contains(L1,'"A"') contains(L1,"A"+"") LOCAL Strg="A" contains(L1,Strg) Viga C  TD  FB 

« Next Oldest  Next Newest »

User(s) browsing this thread: