Post Reply 
Enter date in Prime program?
10-02-2024, 04:17 AM
Post: #3
RE: Enter date in Prime program?
I think pasting results from Chat GPT here is like knocking yourself out, but I'll try to save you a bit Big Grin

A bit of theory: Chat GPT needs a lot of information about a specific programming language to generate something meaningful. In the case of PPL, the amount of information is so limited that it doesn’t meet the required minimum to obtain satisfactory results. When it comes to DAX, you can find hundreds of websites worldwide (in various languages) and forums describing different use cases for this language. For PPL, there are only a few websites with sparse information about this language. The HP Prime user manual also hasn’t been updated for many years.

Nevertheless, putting aside the fact that this program isn't the best idea (selecting a date using three drop-down lists displayed one after another is very inconvenient), it is almost correct. The two fundamental errors are the use of the DATE and DAYSINMONTH functions, which don’t exist in PPL. You can add them yourself, and the program will start working:

Code:
DATE(year,month,day)
BEGIN
  STRING(year+1999) + "-" + RIGHT("0"+STRING(month),2) + "-" + RIGHT("0"+STRING(day),2);
END;

DAYSINMONTH(year, month)
BEGIN
  IFTE(
    month == 2,
    IFTE((year MOD 4 == 0 AND year MOD 100) OR (year MOD 400 == 0),29,28),
    IFTE(POS({4,6,9,11}, month) > 0,30,31)
  );
END;

If you specified more clearly what you want to achieve (thereby limiting the freedom of coming up with a solution), the result could be significantly better.

However, assuming that the way this program works meets our expectations, implementing these two functions is still much less work than implementing everything from scratch. Wink

Piotr Kowalewski
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
RE: Enter date in Prime program? - Jase - 10-01-2024, 11:29 PM
RE: Enter date in Prime program? - komame - 10-02-2024 04:17 AM
RE: Enter date in Prime program? - komame - 10-02-2024, 04:35 AM
RE: Enter date in Prime program? - komame - 10-03-2024, 03:37 AM
RE: Enter date in Prime program? - Tyann - 10-03-2024, 05:01 AM
RE: Enter date in Prime program? - komame - 10-03-2024, 07:16 AM
RE: Enter date in Prime program? - komame - 10-03-2024, 03:13 PM
RE: Enter date in Prime program? - komame - 10-03-2024, 04:36 PM
RE: Enter date in Prime program? - KeithB - 10-02-2024, 08:48 PM
RE: Enter date in Prime program? - Jase - 10-02-2024, 09:27 PM
RE: Enter date in Prime program? - komame - 10-03-2024, 05:54 AM
RE: Enter date in Prime program? - Jase - 10-03-2024, 11:19 PM



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