Post Reply 
MAKELIST()
01-10-2015, 11:23 PM
Post: #1
MAKELIST()
This code fragment compiles ok, but errors at runtime:

Code:

EXPORT test()
BEGIN
local A,J1,T1,KT;

KT:={2.5, pi,3.79,4.22};
J1:=1;                       
T1:=MAKELIST(A,A,KT(J1),1.5*PI,((1.5*PI-KT(J1))/51)); 

END;

Yet, when KT, J1, and T1 are entered in the HOME command line individually, they work just fine. Something in the MAKELIST(...) is troublesome, but what?

Ideas?

-Dale-
Find all posts by this user
Quote this message in a reply
01-10-2015, 11:28 PM
Post: #2
RE: MAKELIST()
It appears that MAKELIST expects the variable to be a global variable A and not a local variable A. Remove A from the list of local variables and your program runs fine. When you use A as a local variable, I believe it substitutes the current value of A into the command (which is presumably 0). So the program essentially does: MAKELIST(0,0,blah...)

Graph 3D | QPI | SolveSys
Find all posts by this user
Quote this message in a reply
01-10-2015, 11:33 PM
Post: #3
RE: MAKELIST()
Thanks, I tried many things, and it has been driving me nuts all day!
-Dale-
Find all posts by this user
Quote this message in a reply
01-10-2015, 11:46 PM
Post: #4
RE: MAKELIST()
This may even be a bug since A here is supposed to be a dummy variable in how it is used in MAKELIST.

Graph 3D | QPI | SolveSys
Find all posts by this user
Quote this message in a reply
01-11-2015, 01:25 AM
Post: #5
RE: MAKELIST()
I'm pretty sure there's a bug or two with makelist. It behaved differently in home, cas, and ppl. I was too tired to write it up and submit it!
Find all posts by this user
Quote this message in a reply
01-11-2015, 01:31 AM (This post was last modified: 01-11-2015 01:32 AM by Han.)
Post: #6
RE: MAKELIST()
(01-11-2015 01:25 AM)DrD Wrote:  I'm pretty sure there's a bug or two with makelist. It behaved differently in home, cas, and ppl. I was too tired to write it up and submit it!

Well, there is a different makelist() function in CAS. MAKELIST() is different from makelist().

MAKELIST(expression, var, start, stop, step): when used in Home view, expression must be in terms of global variables, and var must be a global variable. When used in the CAS view, the command must be manually typed in upper case; var may be any undefined variable. The result is a list delimited by {}.

makelist(function, start, stop, step): a command similar to MAKELIST but designed for CAS use; returns a CAS list delimited by []. The function must be a valid CAS function, either defined in the CAS (e.g. f(x):=x^2, then simply use f as the argument or x->x^2).

When in CAS mode, selecting MAKELIST from the catalog actually produces makelist and uses the makelist() function. You have to manually type MAKELIST in upper case since the catalog auto-switches to lower case when in CAS mode.

In non-CAS PPL, most functions (generally speaking) are assumed to be upper case even when typed in lower case because PPL programs are assumed to be running in Home View. Thus typing makelist() in a non-CAS PPL program will be interpreted as MAKELIST()

Graph 3D | QPI | SolveSys
Find all posts by this user
Quote this message in a reply
01-12-2015, 12:35 PM
Post: #7
RE: MAKELIST()
While working with the difficulty the MAKELIST() command had become for me, I tried many things. The code fragment I presented was just the last 'box' I found myself in.

You are right about needing a global for the dummy var for the MAKELIST() parameters, however that did not resolve my problem. On the command line I could manually enter the MAKELIST() command and it worked. Programmatically, it would cause an error.

Using a global, I could get the full program to work on the emulator, but it would NOT work on the physical device. I trimmed my full program to just a shortened fragment containing the MAKELIST() segment, wherein I used the length() command. It turned out that the length() command would not work on the physical device, programmatically OR on the command line, either.

In short, I did the "C-F-O" ON reset, and it fixed the problems. The program now runs in both environments as hoped. The state of the physical machine had become corrupted in some way.

Not my first encounter with this sort of issue ...
Find all posts by this user
Quote this message in a reply
01-12-2015, 02:18 PM
Post: #8
RE: MAKELIST()
When you say C-F-O reset, do you mean that you formatted the memory of the "c:" drive? Or that you rebooted into C-F-O and then pressed 9 to reset?

If the latter, just doing the "warm start" of on-symb to do a full boot up sequence would have done the same thing to my knowledge.

TW

Although I work for HP, the views and opinions I post here are my own.
Find all posts by this user
Quote this message in a reply
01-12-2015, 03:54 PM
Post: #9
RE: MAKELIST()
I used the "C-F-O ON" '9. Reset' from the list of options. At the end of a tiring day, filled with largely unsuccessful efforts, it was the next thing that occurred to me.

I didn't try "On-Sym" but I will try to remember that for the rigors of my next adventure!
Find all posts by this user
Quote this message in a reply
01-12-2015, 05:01 PM
Post: #10
RE: MAKELIST()
That is basically equivalent to ON-F3 on the 50g (a full reboot). Just don't hold on to SYMB too long or you end up in the bootloader updater...

TW

Although I work for HP, the views and opinions I post here are my own.
Find all posts by this user
Quote this message in a reply
Post Reply 




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