HP Forums
Strange PPL error - Printable Version

+- HP Forums (https://www.hpmuseum.org/forum)
+-- Forum: HP Calculators (and very old HP Computers) (/forum-3.html)
+--- Forum: HP Prime (/forum-5.html)
+--- Thread: Strange PPL error (/thread-18338.html)



Strange PPL error - Dobiray - 05-07-2022 04:12 PM

Hello all,

I am trying to get used to the HP Prime and wrote a very little program in PPL and I am getting a syntax error in line 3. This is the code:

EXPORT CAS2HOME(VALUE)
BEGIN
PRINT(REPLACE(VALUE,"x","X"));
END;

The funny part is it was working before and on my HP Prime simulator it works too, no error message. It stopped working after my HP Prime rebooted because of an error/crash.

What this code should be good for: If I am using formulas in CAS the variable x is lower case but in the HOME environment X should be upper case. This code can be used to replace all lower case x by upper case X and print the new formula. If you now use the copy function you can use paste in the HOME environment and the formula is native HOME.

I am not sure if there is a better way but this is my solution. The best way would be a special paste function from the HP Prime OS.

Hope someone has an idea what is wrong.

Thanks for your help


RE: Strange PPL error - Dobiray - 05-07-2022 08:05 PM

I have drilled down this issue a little bit more with some strange results. In contrast to the help the program works with the following code:

EXPORT CAS2HOME(VALUE)
BEGIN
PRINT(REPLACE(VALUE;"x";"X"));
END;

Well using the same code on the virtual HP Prime under MacOS a "," is needed in order to get it working. I am a bit puzzled. My real HP Prime is G2 and has the latest official Firmware 20211202 the virtual on MacOS (20200116 v14425).

Does this make sense to anyone? By the way the help says REPLACE(Object1,start,Object2).


RE: Strange PPL error - BruceH - 05-07-2022 09:08 PM

What's your decimal point set to, dot or comma?


RE: Strange PPL error - Dobiray - 05-07-2022 09:47 PM

Thanks Bruce,

on the real HP Prime it is comma, I am German, and on the virtual HP Prime it is still at the default state. Man I hate this stuff. I didn't expect the decimal point to influence my programming syntax :-(. This is the same stupid thing as with CSV files on Windows as a German user.

Many thanks for the tip. It works now.


RE: Strange PPL error - roadrunner - 05-08-2022 01:21 AM

From page 602 in the users guide:

[attachment=10683]

-road


RE: Strange PPL error - Thomas_Sch - 05-08-2022 07:52 AM

regarding pragma mode,
see also https://www.hpmuseum.org/forum/thread-17878.html?highlight=pragma


RE: Strange PPL error - Dobiray - 05-08-2022 09:26 AM

So I am not alone :-). My learning on the HP Prime keep it in Englisch default that's the way it is working without headache. All other stuff just makes it too complicated to use. Also my Windows Computers are on English default. With this you have the smallest pain.

It is a great forum here and help is very quick! Thanks a lot

I will go also to the HP 48gx forum to learn more about my 48 which I own since 1993 and the HP Prime should replace.


RE: Strange PPL error - Tim Wessman - 05-08-2022 10:55 AM

The problem was that we had to make it so "a math teacher could type some program functions in" since that was becoming something in math curriculum in Europe. It was decided that this meant it had to work using the current settings, and be recognizable...

Did not really want to do it, but when the decimal separator was something else, and the numbers suddenly no longer matched, it was decided by the powers that be that the solution was to make it accept 123,456 if you were in a place that uses that.

Not great, we did not particularly want to do it because it made things more complex, but there you go. That is the reason. Smile


RE: Strange PPL error - Dobiray - 05-08-2022 03:38 PM

Hello Tim,

thanks for the answer why it was done like this. I know it from work sometimes you have to do stuff which is not 100% as you would do it. Life and development is always a compromise ;-). Nothing comes for free.