HP Forums
Programs() - 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: Programs() (/thread-2717.html)



Programs() - Tyann - 12-28-2014 07:29 AM

Hello.
After updating my machine from a PC running Windows 8, a small modest example of the use of the new command Programs ().
Code:

EXPORT Exist(n)
BEGIN
 SIGN(POS(Programs(),n));
END;



RE: Programs() - compsystems - 12-28-2014 04:51 PM

Programs(), returns the list of programs, ideal to keep on rewriting a program by accident, but it would be better to define a working directory

FOLDER myProject

EXPORT Exist(n)
BEGIN
SIGN(POS(Programs(),n));
END;

END;
-----------------

Sample the use of the function Programs()

EntryLine

Exist("Exist") [ENTER] returns 1 (true found )

Exist("abcdee") [ENTER] returns 0 ( false not found )

Request for the HPPrime team

If the argument is ("HOME") to return the list of programs type HOME, if the argument is ("CAS") return the list of programs type CAS

Programs("HOME") [ENTER] { .... }

Programs("CAS") [ENTER] { .... }


RE: Programs() - bobkrohn - 12-29-2014 06:09 AM

Thanks
This doesn't show up in the Catalog on my machine.
Had to play with it to discover that it generates a List.

"Programs()" works from Home and creates a List

But for some reason the program code example did not work on my machine using RUN in Program Editor.
I tried using program name in quotes and without
Works from Home when used as a Function call and keyed in directly though.


RE: Programs() - Didier Lachieze - 12-29-2014 07:51 AM

(12-29-2014 06:09 AM)bobkrohn Wrote:  But for some reason the program code example did not work on my machine using RUN in Program Editor.
I tried using program name in quotes and without
Works from Home when used as a Function call and keyed in directly though.
See the remark at the end of Part II - section 1 of HP Prime Programming: An Introduction.


RE: Programs() - bobkrohn - 12-29-2014 08:28 AM

I'm not following or seeing the relevance the citation you point out.

Using RUN in Program Editor list of programs, it will pop up an Input Box for the variable "n".
Input Box does not allow text entry as in "MyProgram".
It doesn't make any sense to me but may be yet another big BUG in HP Prime.


RE: Programs() - Didier Lachieze - 12-29-2014 09:12 AM

(12-29-2014 08:28 AM)bobkrohn Wrote:  Using RUN in Program Editor list of programs, it will pop up an Input Box for the variable "n".
Input Box does not allow text entry as in "MyProgram".
This is exactly what is explained in the text I pointed out, using RUN in Program Editor you can enter only real numbers as inputs to your program:
Quote:Remark: When a program which takes arguments is executed from the Run menu option in the Program Catalog, then the argument variables are initialized to real numbers, and have a default value of 0. While this feature is nice in that it allows users to enter their arguments in a nice input form, the input form will only accept real-valued inputs and produce input errors otherwise. So while PROG1 was designed to expect a string of characters as its input, executing it from the Run menu option prevents users from actually using a string as an argument!



RE: Programs() - bobkrohn - 12-30-2014 12:49 AM

Oh, OK when it's explained as you have done it's clear now.
Thank You.


RE: Programs() - Tim Wessman - 12-30-2014 12:59 AM

(12-29-2014 09:12 AM)Didier Lachieze Wrote:  This is exactly what is explained in the text I pointed out, using RUN in Program Editor you can enter only real numbers as inputs to your program:

Dang! Thought that had been fixed already. :-(


RE: Programs() - bobkrohn - 12-30-2014 06:19 AM

It's certainly not an intuitive "feature".