When I first started writing programs on the HP Prime I noticed that when I invoked the User menu in the Toolbox that every program appeared with a submenu to the the right that contained a single entry with the name associated with the EXPORT statement. By default when using the New soft key to create a new program, the names would be the same, but could be edited such that they differed. Furthermore, I figured out that if I placed multiple program blocks with EXPORT namex BEGIN statements END; in the program, that they would appear in a list to the right of the program name and could be executed separately. This is very useful when you have multiple actions that you want to perform under a single topic heading and greatly reduces the clutter in the main User menu. For example, I want to change the Entry Mode to the choices of Textbook, Algebraic or RPN, so I created a program named "Entry_Mode" that contained three blocks named Textbook, Algebraic and RPN as follows:
Entry_Mode
EXPORT Textbook()
BEGIN
Entry:=0;
END;
EXPORT Algebraic()
BEGIN
Entry:=1;
END;
EXPORT RPN()
BEGIN
Entry:=2;
END;
When I select Entry_Mode in the User program menu, the three choices Textbook, Algebraic and RPN appear to the right. When I select the choice and press Enter, the name appears in the command line and another Enter creates the result in the Home or CAS screen. For example, Textbook appears as:
Textbook ----> 0.0000
assuming number format is FIX 4
Another example is polar to rectangular and rectangular to polar
coordinates conversion. Originally, I had two separate programs named Rect_to_Polar and Polar_to_Rect, but I've now consolidated them into a single program under the name PR_Convert, as follows:
PR_Convert
EXPORT Rect_to_Polar(X1,X2)
BEGIN
LOCAL CRP,CIP,CTOT;
CRP:=(X1^2+X2^2)^.5;
CIP:=ATAN(X2/X1);
CTOT:=(CRP,CIP);
RETURN CTOT;
END;
EXPORT Polar_to_Rect(X1,X2)
BEGIN
LOCAL CRP,CIP,CTOT;
CRP:=X1*COS(X2);
CIP:=X1*SIN(X2);
CTOT:=(CRP,CIP);
RETURN CTOT;
END;
Upon selection and execution, the user is prompted on the command line to enter the two coordinate parameters, e.g.:
Rect_to_Polar(3,4) ----> (5.000,5301) in degrees mode