programming the prime
03-24-2015, 08:57 PM
Post: #1
 leprechaun Member Posts: 90 Joined: Mar 2015
programming the prime
Hello to the forums!

I am relatively new to the prime and somehow stuck in the learning process. As a result it is likely that I will post several dumb or silly questions in the future.
I hope you can help me with the machine....

Based on some tutorials I tried the following

Code:
 EXPORT fircore(N) BEGIN   LOCAL core:=seq(0,N); END;

Codecheck complains: Syntax Error.

Code:
 EXPORT fircore(N) BEGIN   LOCAL core:=seq(0,10); END;
That would work.... Can you explain the issue and give startup tips to master the machine some day?

Thanks
03-24-2015, 09:15 PM (This post was last modified: 03-25-2015 06:25 AM by Han.)
Post: #2
 Han Senior Member Posts: 1,882 Joined: Dec 2013
RE: programming the prime
(03-24-2015 08:57 PM)leprechaun Wrote:  Hello to the forums!

I am relatively new to the prime and somehow stuck in the learning process. As a result it is likely that I will post several dumb or silly questions in the future.
I hope you can help me with the machine....

Based on some tutorials I tried the following

Code:
 EXPORT fircore(N) BEGIN   LOCAL core:=seq(0,N); END;

Codecheck complains: Syntax Error.

Code:
 EXPORT fircore(N) BEGIN   LOCAL core:=seq(0,10); END;
That would work.... Can you explain the issue and give startup tips to master the machine some day?

Thanks

You're using the "," for fractional separators. This in turn makes the separator character ";" (by default, the "." is the fraction mark and "," is the separator). Thus, when you type:

seq(0,10)

it gets interpreted as call the seq() function with a single argument whose value is $$\frac{1}{10}$$. It doesn't work in the case of seq(1,N) because the calculator does not allow symbolic fractional parts. Press [Menu] while program editor and select "Insert Pragma" (place it at the top) and change the ( , ; ; ) to ( . , ; ) if you want to use regular commas and decimal points in your programs but not elsewhere. The alternative is to make sure that you remember "," means fraction mark, and ";" means separator.  Or thirdly, change your numeric display option in the settings.

The pragma ( . , ; ) tells the editor that "." is the fraction mark, "," is the separator, and ";" ends a command line. So you could theoretically use: ( , . ; ) if you want, or even ( , ; , ) and end all commands with a "," symbol! (Not all symbols are allowed, though.

Graph 3D | QPI | SolveSys
03-25-2015, 12:04 PM
Post: #3
 leprechaun Member Posts: 90 Joined: Mar 2015
RE: programming the prime
All sollutions work! Thank you.
I would have NEVER figured that out. I think a pragma is the best just in case I'll share my programs with somebody in the future. You never know.

I am sure there are dozens of similar trivial problems to come ;-)
 « Next Oldest | Next Newest »

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