Post Reply 
Control (programmatically) if a list exist, otherwise create it
05-18-2015, 04:10 PM
Post: #1
Control (programmatically) if a list exist, otherwise create it
hi all,
what's the simplest way to control (programmatically) if a list exist, otherwise create it (then edit it with EDITLIST)?

thank you
Salvo

∫aL√0mic (IT9CLU), HP Prime 50g 41CX 71b 42s 12C 15C - DM42 WP34s :: Prime Soft. Lib
Visit this user's website Find all posts by this user
Quote this message in a reply
05-18-2015, 05:14 PM
Post: #2
RE: Control (programmatically) if a list exist, otherwise create it
(05-18-2015 04:10 PM)salvomic Wrote:  hi all,
what's the simplest way to control (programmatically) if a list exist, otherwise create it (then edit it with EDITLIST)?

thank you
Salvo

Hi Salvo,
Maybe you can use the length command to determine if a list is already created.

Code:

IF length(L1)==0 THEN
...
ELSE
...
END;

Just a tricky idea.

Success is the ability to go from one failure to the next without any loss of enthusiasm.
View PNG/JPG in your Prime
Visit this user's website Find all posts by this user
Quote this message in a reply
05-18-2015, 05:26 PM
Post: #3
RE: Control (programmatically) if a list exist, otherwise create it
(05-18-2015 05:14 PM)mandresve Wrote:  
Code:

IF length(L1)==0 THEN
...
ELSE
...
END;

Just a tricky idea.

thank you,
I'm trying with variable flows (program for IRR): if flows doesn't exist my program gives "Error:unlatch control word" ... I dunno what it means...

Salvo

∫aL√0mic (IT9CLU), HP Prime 50g 41CX 71b 42s 12C 15C - DM42 WP34s :: Prime Soft. Lib
Visit this user's website Find all posts by this user
Quote this message in a reply
05-19-2015, 05:23 AM
Post: #4
RE: Control (programmatically) if a list exist, otherwise create it
Hello,

look at the TYPE and SIZE commands to test if a varaible is a list (type 6) and it's size.

use Solve.SOLVE rather than fsolve for the solving of the IRR, it probably will work better in this case as it will not call the CAS.

cyrille
Find all posts by this user
Quote this message in a reply
05-19-2015, 09:40 AM (This post was last modified: 05-19-2015 04:25 PM by salvomic.)
Post: #5
RE: Control (programmatically) if a list exist, otherwise create it
(05-19-2015 05:23 AM)cyrille de brébisson Wrote:  Hello,
look at the TYPE and SIZE commands to test if a varaible is a list (type 6) and it's size.
use Solve.SOLVE rather than fsolve for the solving of the IRR, it probably will work better in this case as it will not call the CAS.
cyrille

thank you, Merci, Cyrille,
I'll try it this evening at home. If it works I'll be able to avoid to call CAS and could solve two problem in few rows of code.

Salvo

EDIT: however now I'm trying with solve() and not fsolve() and it works better also with the "11 element list" (2 results, but the first, the negative one has -1 added...), however in CAS Terminal gives the message "Warning, argument is not an equation, solving ...", in Home no message.

Instead, Solve.SOLVE() works in Home and CAS, but gives only one result...

Much better, however!

∫aL√0mic (IT9CLU), HP Prime 50g 41CX 71b 42s 12C 15C - DM42 WP34s :: Prime Soft. Lib
Visit this user's website Find all posts by this user
Quote this message in a reply
Post Reply 




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