Post Reply 
parse var in a cycle (like j -> Cj)
03-08-2015, 11:31 AM
Post: #1
parse var in a cycle (like j -> Cj)
hi all,
I little help to make in a program something like: to parse columns os Statistics adding a var in a cycle.
i.e. I must get C1, C2, C3 and I think to do:
FOR j FROM 0 TO 9 DO
// use Cj (C0, C1, C2...), but I cannot use Cj as it would be another var... and not C(j)...
n:= size(Cj); // doesn't work...
END;

thank you!

∫aL√0mic (IT9CLU) :: HP Prime 50g 41CX 71b 42s 39s 35s 12C 15C - DM42, DM41X - WP34s Prime Soft. Lib
Visit this user's website Find all posts by this user
Quote this message in a reply
03-08-2015, 12:08 PM
Post: #2
RE: parse var in a cycle (like j -> Cj)
Would using lists work for you? Something like:

Code:

EXPORT Varb()
BEGIN
local n, CL:={'C0', 'C1', 'C2'} ;

for n from 1 to length(CL) do
  print(CL(n));
end;

END;
Find all posts by this user
Quote this message in a reply
03-08-2015, 01:00 PM
Post: #3
RE: parse var in a cycle (like j -> Cj)
(03-08-2015 12:08 PM)DrD Wrote:  Would using lists work for you? Something like:

[code]
EXPORT Varb()
BEGIN
local n, CL:={'C0', 'C1', 'C2'} ;

...

I can try.
I must calculate for example mean on the lists, so sum their items and so on...
I'll try in a few minutes, than I'll tell you,
thanks
Salvo

∫aL√0mic (IT9CLU) :: HP Prime 50g 41CX 71b 42s 39s 35s 12C 15C - DM42, DM41X - WP34s Prime Soft. Lib
Visit this user's website Find all posts by this user
Quote this message in a reply
03-08-2015, 04:20 PM
Post: #4
RE: parse var in a cycle (like j -> Cj)
yes, it works!
but with eval()

see here.

Code:

local DL:={eval('D1'), eval('D2'), ...}

∫aL√0mic (IT9CLU) :: HP Prime 50g 41CX 71b 42s 39s 35s 12C 15C - DM42, DM41X - WP34s Prime Soft. Lib
Visit this user's website Find all posts by this user
Quote this message in a reply
03-08-2015, 07:00 PM
Post: #5
RE: parse var in a cycle (like j -> Cj)
(03-08-2015 04:20 PM)salvomic Wrote:  yes, it works!
but with eval()

see here.

Code:

local DL:={eval('D1'), eval('D2'), ...}

Lists are very useful, for example, you can evaluate each element in the list:
Code:

EXPORT Varb()
BEGIN

local a:=1,b:=2,c:=3, DL:={'a',' b', 'c'};
RETURN EVAL(DL);  //  Evaluates each element in the list DL

END;
Find all posts by this user
Quote this message in a reply
03-08-2015, 07:07 PM
Post: #6
RE: parse var in a cycle (like j -> Cj)
(03-08-2015 07:00 PM)DrD Wrote:  Lists are very useful, for example, you can evaluate each element in the list:

yes, you're write, I agree

∫aL√0mic (IT9CLU) :: HP Prime 50g 41CX 71b 42s 39s 35s 12C 15C - DM42, DM41X - 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: 3 Guest(s)