rpl:start

About RPL programming and what not.

The page can grow and then be split in different pages, using this as starting point.

See also this thread on the MoHPC: http://www.hpmuseum.org/forum/thread-10271.html

%%HP: T(0)A(D)F(.); @ alternative found online %%HP: T(3)A(R)F(.); @ You may edit the T(0)A(D)F(.) parts. @ The earlier parts of the line are used by Debug4x. @ in npp, just select language "normal" to get rid of the highlight. DIR @################################## @# @# vector or matrix operations @ url: '-', @ tags: [ 'vector operations' ], @ description: @ see 50g user manual page 9-20 @ it transforms a row vector like [1 2 3] @ in a column vector that is a matrix @ and viceversa @input: @L1: a row vector like [1 2 3] rowVtoColV \<< OBJ\-> 1 + \->ARRY >> @input: @L1: a colum vector like [[1] [2] [3]] (that is, a matrix) colVtorowV \<< OBJ\-> @explode the matrix OBJ\-> @explode the dimension list DROP @keep only the first dimension, the number of rows \->ARRY @make a vector. >> @ url: '-', @ tags: [ 'vector operations' ], @ description: @ see 50g user manual page 10-11 infoColVtoRowV "See also the command RDM that shoudl be more efficient" @ url: '-', @ tags: [ 'vector operations' ], @ description: @ see 50g user manual page 9-23 @ it transforms a list in a vector like [1 2 3] listToVector \<< OBJ\-> 1 \->LIST \->ARRY \>> @ url: '-', @ tags: [ 'vector', 'angle between vectors' ], @ description: @ see 50g user manual page 9-16 @ and math.stackexchange.com/questions/1047649/distance-and-angle-between-vectors-in-multiple-dimensions @input @L2: row vector @L1: row vector angleBetweenTwoVectors \<< \-> @input lvVector1 lvVector2 \<< lvVector1 lvVector2 DOT lvVector1 ABS lvVector2 ABS * / ACOS \>> \>> @ url: '-', @ tags: [ 'vector', 'angle between vectors' ], @ description: @ see 50g user manual page 9-16 @ and math.stackexchange.com/questions/1047649/distance-and-angle-between-vectors-in-multiple-dimensions @input @L2: arm of the force vector @L1: force vector @output @L2: moment vector @L1: angle used to compute the norm of the moment vector @ between force vector and arm of the force vector momentOfAForce \<< 0 @lvVectorMoment \-> @input lvVectorArmForce lvVectorForce @var lvVectorMoment \<< lvVectorArmForce lvVectorForce CROSS DUP 'lvVectorMoment' STO "momentVector" \->TAG @computing the angle X such that @ norm(Moment) = norm(Force) * norm(armForce) * sin(X) lvVectorMoment ABS lvVectorArmForce ABS lvVectorForce ABS * / ASIN "Angle" \->TAG \>> \>> @info @ url: 'www.hpmuseum.org/forum/thread-3786-post-82450.html#pid82450', @ tags: [ 'matrix operations' ], @ description: @ interesting link about applying a function to a matrix. infoApplyFuncToMatrix "[[ -9 0 -1 -4 ] [ 4 9 3 3 ] [ 0 4 -9 9 ] [ 5 -1 -6 -4 ]] 'LN(X)' DIAGMAP XNUM " @ url: '-', @ tags: [ 'vector', 'equation of a plane' ], @ description: @ see 50g user manual page 9-17 @ and math.stackexchange.com/questions/753113/how-to-find-an-equation-of-the-plane-given-its-normal-vector-and-a-point-on-the @ Given a normal vector to a plane and a point in it, return a vector that defines @ the equation of the plane. @Remarks: @ no input check, the vectors should have 3 components otherwise the program @ does not work as intended. @input @L2: normal vector to the plane @L1: point in the plane @output @L1: a vector defining the coefficients for the axis @ X,Y,Z plus a constant. @ Say the result will be [4 6 2 -24] if the equation of the plane is @ 4x+6y+2z-24=0 . eqPlaneNormalVandPoint \<< \-> lvNormalVector lvPointInPlane \<< lvNormalVector lvNormalVector lvPointInPlane DOT 4 @remember it works only for 3 dimensional vectors COL+ \>> \>> @ url: '-', @ tags: [ 'matrix', 'from a series of list to a matrix' ], @ description: @ see 50g user manual page 10-14 @input @L2-Ln+1: n lists of the same dimension @L1: number of lists to consider on the stack @output @L1: a matrix with the lists as columns lists2matrixColumns \<< DUP \-> n \<< 1 SWAP FOR j OBJ\-> \->ARRY IF j n < THEN j 1 + ROLL END NEXT IF n 1 > THEN 1 n 1 - FOR j j 1 + ROLL NEXT END n COL\-> \>> \>> @input @L2-Ln+1: n lists of the same dimension @L1: number of lists to consider on the stack @output @L1: a matrix with the lists as rows lists2matrixRows \<< DUP \-> n \<< 1 SWAP FOR j OBJ\-> \->ARRY IF j n < THEN j 1 + ROLL END NEXT IF n 1 > THEN 1 n 1 - FOR j j 1 + ROLL NEXT END n ROW\-> \>> \>> @alternative solution @input @L2-Ln+1: n lists of the same dimension @L1: number of lists to consider on the stack @output @L1: a matrix with the lists as columns lists2matrixColumnsNo2 \<< @note that we do not consume as input, immediately, @all the lists 0 "lvInputLists" DROP \-> @input lvListsNumber @var lvInputLists \<< lvListsNumber \->LIST @put the lists in one big list @ as { 1 } { 2 } 2 \->LIST produces { {1} {2} } 'lvInputLists' STO lvInputLists 1 \<< listToVector @program included before \>> DOSUBS @we have a list of row vectors now @explode the list and make a matrix OBJ\-> COL\-> \>> \>> @alternative solution @input @L2-Ln+1: n lists of the same dimension @L1: number of lists to consider on the stack @output @L1: a matrix with the lists as rows lists2matrixRowsNo2 \<< @note that we do not consume as input, immediately, @all the lists 0 "lvInputLists" DROP \-> @input lvListsNumber @var lvInputLists \<< lvListsNumber \->LIST @put the lists in one big list @ as { 1 } { 2 } 2 \->LIST produces { {1} {2} } 'lvInputLists' STO lvInputLists 1 \<< listToVector @program included before \>> DOSUBS @we have a list of row vectors now @explode the list and make a matrix OBJ\-> ROW\-> \>> \>> @alternative solution @ REMARKS: @ - using listExt www.hpcalc.org/details/7971 @input @L2-Ln+1: n lists of the same dimension @L1: number of lists to consider on the stack @output @L1: a matrix with the lists as rows lists2matrixRowsNo3 \<< @note that we do not consume as input, immediately, @all the lists 0 "lvInputLists" DROP 0 "lvSingleListSize" DROP \-> @input lvListsNumber @var lvInputLists lvSingleListSize \<< @get one list size, presuming equal dimension for all. DUP SIZE 'lvSingleListSize' STO lvListsNumber \->LIST @put the lists in one big list @ as { 1 } { 2 } 2 \->LIST produces { {1} {2} } 'lvInputLists' STO lvInputLists LXIL @explodes all sublists listToVector @program included before @we have one row vector now lvListsNumber @rows lvSingleListSize @columns 2 \->LIST RDM \>> \>> @alternative solution @input @L2-Ln+1: n lists of the same dimension @L1: number of lists to consider on the stack @output @L1: a matrix with the lists as columns lists2matrixColumnsNo3 \<< lists2matrixRowsNo3 TRAN \>> @alternative solution @input @L2-Ln+1: n lists of the same dimension @L1: number of lists to consider on the stack @output @L1: a matrix with the lists as rows lists2matrixRowsNo4 \<< \->LIST @put the lists in one big list @ as { 1 } { 2 } 2 \->LIST produces { {1} {2} } AXL \>> @alternative solution @input @L2-Ln+1: n lists of the same dimension @L1: number of lists to consider on the stack @output @L1: a matrix with the lists as columns lists2matrixColumnsNo4 \<< lists2matrixRowsNo4 TRAN \>> @input @L1: a matrix @output @L1: list representing the rows of a matrix in sublists matrixRows2list "just use AXL" @input @L1: a matrix @output @L1: list representing the columns of a matrix in sublists matrixColumns2list \<< TRAN AXL \>> @################################## @# @# 50g filesystem operations @ url: 'www.hpmuseum.org/cgi-sys/cgiwrap/hpmuseum/archv016.cgi?read=103110', @ tags: [ 'directory management', 'sorting variables', 'file manager' ], @ description: 'the code orders the contents of a directory and subdirectories', @ Download to 49(and 50) series in exact mode. @ @ !! @ Recursive program; change ProgName within program to whatever @ !! @ @ name is chosen for storing the program. @ Results from the BYTES command: @ 48G series: @ Checksum: # 5394h @ Size: 129 @ 49 series: @ Checksum: # C209h @ Size: 125. orderDirContents \<< @ Begin program. VARS @ Get list of variables. DUP @ Copy of variables list. IF @ SIZE @ Variables list not empty? THEN SORT @ Sort list to ASCII order. ORDER @ Reorder variables. 15 TVARS @ Get list of subdirectories. DUP @ Copy of subdirectories list SIZE @ Number of subdirectories. IF @ DUP @ Subdirectories list not empty? THEN @ OVER @ Copy of subdirectory list. ORDER @ Move subdirectories to front. 1 @ Loop begin index. SWAP @ Move down number of subdirectories. FOR n @ For each subdirectory. DUP @ Copy of subdirectory list. n GET @ Get subdirectory name. EVAL @ Make subdirectory current. ProgName @ Call this program recursively. UPDIR @ Return to parent directory. NEXT @ DROP @ Discard subdirectories list. ELSE @ DROP2 @ Discard empty subdirectories list and size 0. END @ ELSE @ DROP @ Discard empty variables list. END \>> @ End program. @################################## @# @# Math operations @url: 'www.hpmuseum.org/cgi-sys/cgiwrap/hpmuseum/archv016.cgi?read=105876', @tags: [ 'polar', 'rectangular', 'coordinate system' ], @description: 'several userRPL programs to switch from polar to rectangular @ representation of numbers', @ 2 dimensional P\->R program. @ Arguments: 2 reals representing r and theta. @ Returns: 2 reals representing x and y. polar2rect \<< @ Begin program. RCLF @ Get current flags. ROT ROT @ Move flags list to level 3. @ On 49 series, UNROT may be used @ instead of ROT ROT. CYLIN @ Force cylindrical display mode. @ SPHERE would work as well here. \->V2 @ Combine into vector or complex. RECT @ Force rectangular display mode. V\-> @ Decompose into reals. ROT @ Move flags list back to level 1. STOF @ Restore original flags. \>> @ 2 dimensional R\->P program. @ Arguments: 2 reals representing x and y. @ Returns: 2 reals representing r and theta. rect2polar \<< @ Begin program. RCLF @ Get current flags. ROT ROT @ Move flags list to level 3. @ On 49 series, UNROT may be used @ instead of ROT ROT. RECT @ Force rectangular display mode. \->V2 @ Combine into vector or complex. CYLIN @ Force cylindrical display mode. @ SPHERE would work as well here. V\-> @ Decompose into reals. ROT @ Move flags list back to level 1. STOF @ Restore original flags. \>> @ 3 dimensional Cylindrical\->Rectangular program. @ Arguments: 3 reals representing r, theta, and z. @ Returns: 3 reals representing x, y, and z. cylindrical2rectangular \<< @ Begin program. RCLF @ Get current flags. 4 ROLLD @ Move flags list to level 4. CYLIN @ Force cylindrical display mode. \->V3 @ Combine into vector. RECT @ Force rectangular display mode. V\-> @ Decompose into reals. 4 ROLL @ Move flags list back to level 1. STOF @ Restore original flags. \>> @ 3 dimensional Rectangular\->Cylindrical program. @ Arguments: 3 reals representing x, y, and z. @ Returns: 3 reals representing r, theta, and z. rectangular2cylindrical \<< @ Begin program. RCLF @ Get current flags. 4 ROLLD @ Move flags list to level 4. RECT @ Force rectangular display mode. \->V3 @ Combine into vector. CYLIN @ Force cylindrical display mode. V\-> @ Decompose into reals. 4 ROLL @ Move flags list back to level 1. STOF @ Restore original flags. \>> @ 3 dimensional Spherical\->Rectangular program. @ Arguments: 3 reals representing rho, phi, and theta. @ Returns: 3 reals representing x, y, and z. spherical2rectangular \<< @ Begin program. RCLF @ Get current flags. 4 ROLLD @ Move flags list to level 4. SPHERE @ Force spherical display mode. \->V3 @ Combine into vector. RECT @ Force rectangular display mode. V\-> @ Decompose into reals. 4 ROLL @ Move flags list back to level 1. STOF @ Restore original flags. \>> @ 3 dimensional Rectangular\->Spherical program. @ Arguments: 3 reals representing x, y, and z. @ Returns: 3 reals representing rho, phi, and theta. rectangular2spherical \<< @ Begin program. RCLF @ Get current flags. 4 ROLLD @ Move flags list to level 4. RECT @ Force rectangular display mode. \->V3 @ Combine into vector. SPHERE @ Force spherical display mode. V\-> @ Decompose into reals. 4 ROLL @ Move flags list back to level 1. STOF @ Restore original flags. \>> @ 3 dimensional Cylindrical\->Spherical program. @ Arguments: 3 reals representing r, theta, and z. @ Returns: 3 reals representing rho, phi, and theta. cylindrical2spherical \<< @ Begin program. RCLF @ Get current flags. 4 ROLLD @ Move flags list to level 4. CYLIN @ Force cylindrical display mode. \->V3 @ Combine into vector. SPHERE @ Force spherical display mode. V\-> @ Decompose into reals. 4 ROLL @ Move flags list back to level 1. STOF @ Restore original flags. \>> @ 3 dimensional Spherical\->Cylindrical program. @ Arguments: 3 reals representing rho, phi, and theta. @ Returns: 3 reals representing r, theta, and z. spherical2cylindrical \<< @ Begin program. RCLF @ Get current flags. 4 ROLLD @ Move flags list to level 4. SPHERE @ Force spherical display mode. \->V3 @ Combine into vector. CYLIN @ Force cylindrical display mode. V\-> @ Decompose into reals. 4 ROLL @ Move flags list back to level 1. STOF @ Restore original flags. \>> @url: 'www.hpmuseum.org/cgi-sys/cgiwrap/hpmuseum/archv021.cgi?read=223680', @tags: [ 'Euler totient' ], @description: @ See oeis.org/A000010 . @ Note: the 50g has this function natively implemented. @ eulerTotient \<< DUP IF 1 \=/ THEN { } SWAP FACTORS DUP SIZE 1 SWAP FOR i DUP i GET ROT + SWAP 2 STEP { } SWAP DUP SIZE 2 SWAP FOR i DUP i GET ROT + SWAP 2 STEP DROP 1 - OVER SWAP \<< ^ \>> DOLIST SWAP 1 - + \PILIST END \>> @examples: [ @ 'Input: 98765430111 @ Output: 61497371520', @], @url: 'www.hpmuseum.org/forum/archive/index.php?thread-4162.html', @tags: [ 'farey sequence', 'fractions' ], @description: ' @ computes the farey sequence @ en.wikipedia.org/wiki/Farey_sequence @', fareySequence \<< \-> n \<< { [ 0 1 ] } 0 1 DUP n WHILE OVER n < REPEAT \-> a b c d \<< c d \->V2 + c d n b + d / IP DUP c * a - SWAP d * b - \>> END DROP2 DROP2 \>> \>> @examples: [ @ 'Input: the wanted <n> terms of the sequence @ Output: the farey sequence', @], @url: '-', @tags: [ 'random number', 'statistics' ], @description: @ returns a random integer number between 1 and the value given @Input: an integer number (as real) @output: an integer (as real) between 1 and the input inclusive randInt \<< RAND * 1 + IP \>> @url: 'groups.google.com/d/msg/comp.sys.hp48/mK0ywSIJ5Ho/5lP9xux0CAAJ', @tags: [ 'random integer list' ], @description: @ random integer list without duplicates @input @L2: max positive integer (from 1) @L1: number of integers to get @example: @L2: 10 (we want the integers between 1 and 10) @L1: 5 (we want 5 integers) \<< \-> t n \<< 1 t FOR x x DUP RAND * CEIL ROLLD NEXT t n - DROPN n \->LIST \>> \>> @################################## @# @# list operations and math on list @url: 'www.hpmuseum.org/cgi-sys/cgiwrap/hpmuseum/archv016.cgi?read=103417', @tags: [ 'geometric mean', 'statistics' ], @description: ' @ computes the geometric mean @', geometricMean \<< \-> list \<< list \PILIST list SIZE XROOT \>> \>> @examples: [ @ 'Input: a list of numbers @ Output: the geometric mean', @], @url: '-', @tags: [ 'harmonic mean', 'statistics' ], @description: ' @ computes the harmonic mean @ See also official hp 50g user guide (the large one with 800+ pages) page 8-15 @', @examples: @ - See official hp 50g user guide (the large one with 800+ pages) page 8-15 @Input: @L1: a list of samples of which we want the harmonic mean. @Output: the harmonic mean harmonicMean \<< DUP SIZE \-> @input lvInputList lvInputListSize \<< lvInputList INV \GSLIST lvInputListSize / INV \>> \>> @url: '-', @tags: [ 'weighted average', 'statistics' ], @description: ' @ See also official hp 50g user guide (the large one with 800+ pages) page 8-17 @', @examples: @ - See official hp 50g user guide (the large one with 800+ pages) page 8-17 @Input: @L2: A list of samples @L1: A list of weights @Output: the weighted average weightedAverage \<< \-> @input lvSampleList lvWeightList \<< lvSampleList lvWeightList * \GSLIST lvWeightList \GSLIST / \>> \>> @url: 'www.hpmuseum.org/forum/archive/index.php?thread-4138.html', @tags: [ 'average', 'moving average', 'statistics', 'list processing' ], @description: ' @ computes the moving average and the average of a list @average @Input: a list of numbers @Output: the average average \<< DUP \GSLIST SWAP SIZE / \>> @moving average @input: @ L2: a list @ L1: a number of elements to consider to compute the moving average @output: @ L1: the list with moving averages movingAverage \<< \-> N \<< N \<< N \->LIST average \>> DOSUBS \>> \>> @url: 'www.hpmuseum.org/forum/thread-8209-post-81657.html#pid81657', @tags: [ 'list processing' ], @description: @ increment an element in a list given the increment and the position @input: @L3: list to increment @L2: position @L1: increment (or decrement with a negative number) @output: a list with the element in position incremented (or decremented @ by the specified amount) incrListElement \<< PICK3 PICK3 GET + PUT \>> @url: 'www.hpmuseum.org/forum/thread-8209-post-81657.html#pid81657', @tags: [ 'list processing' ], @description: @ create a list of zero elements except one in a particular position @input: @L3: value to put in the list @L2: position @L1: list size @output: a list of zeroes with the specified value in the given position listOneOne \<< 0 SWAP NDUPN \->LIST SWAP ROT PUT \>> @url: 'www.hpmuseum.org/forum/thread-8209-post-81669.html#pid81669', @tags: [ 'stack processing' ], @description: ' @ reverse the order of the last 3 stack elements. @ url: 'www.hpmuseum.org/cgi-sys/cgiwrap/hpmuseum/archv021.cgi?read=238006', @ tags: [ 'list processing' ], @ description: 'take a list in input and split it in a list of @ sublists in output where a sublists first element would be @ the last element of the previous sublists. Sublists of size 3', @ userrpl : ' @ , @ examples: [ @ 'Input: {1 2 3 4 5 } @ Output: {{ 1 2 3} {3 4 5}}', @ ], splitList \<< 3 \<< 3 \->LIST NSUB 2 MOD NOT DROPN \>> DOSUBS \>> @url: 'www.hpmuseum.org/forum/thread-8209-post-81669.html#pid81669', @tags: [ 'list processing' ], @description: ' @ create a list of n equal objects @input: @L2: object to replicate @L1: number of replications @output @a list with the replicated object nreplication2list \<< NDUPN \->LIST \>> @url: 'www.hpmuseum.org/forum/thread-8209-post-82417.html#pid82417', @tags: [ 'list processing' ], @description: @ remove all entries of an element in a list. @ Requires the listExt of DavidM. @input: @L2: a list @L1: an object to match removeElementFromList \<< OVER SWAP MPOS LRMOV \>> @ouput @L1: the list in input without the entries that matched the object @################################## @# @# Stack operations @that is from L3 L2 L1 @one obtains L1 L2 L3 rev3stack \<< SWAP ROT \>> @info snippet @url: 'www.hpmuseum.org/forum/thread-8209-post-81686.html#pid81686', @tags: [ 'stack processing', 'rule of thumb' ], @description: infoSingleArgStackOp " stack operations that take a numeric argument (DUPN, ROLL, PICK, etc.) take about 7 times as long to execute as simple operations (SWAP, DUP, ROT, etc.) " @################################## @# @# user input operations @url: 'groups.google.com/forum/#!original/comp.sys.hp48/o4XwzdSzWhc/-TZrBqVzgcEJ', @tags: [ 'input forms', 'inform' ], @description: ' @ There are alternatives to good old INFORM or INPUT, @such as INLIST, INMENU, and INPROMPT @ @INLIST is an INFORM replacement, having all these same features: @ @o Editing (including a CALC mode for stack calculations) @o Optional "reset values" @o Optional object type restriction @ @ @But INLIST is not limited @to what can be crammed into one small form, @because its "form" is open-ended and *scrolls* vertically. @ @The INLIST arguments are similar to INFORM: @ @ @"Title" { prompts } { initial values } @-OR- @"Title" { prompts } { reset values } { initial values } @ @ @Note: Lists other than "prompts" @may be empty or shorter than the "prompts" list. @ @Each "prompt" in the list of prompts is: @ @o "Any string" (or any word) @-OR- @o A list: { "Prompt" type1 type2 .. } for object type restriction @ @How to enter data using INLIST: @Highlight any item; press OK or ENTER to edit. @ @Individual value "reset" is invoked @by a blank edit area (press ON once if not yet blank). @ @Individual value CALC mode is invoked @by typing only an "equal" command [=3D] into the edit area @(left-shifted zero on 48G, right-shifted W on 49G/50G); @return from CALC mode via CONT (left-shifted ON). @ @ @Also use CALC mode to see the list of valid object TYPES. @ @"Reset All" is invoked @by an item at the very end of the form. @ @ @"<DONE>" provides the normal exit from INLIST; @ON or "Cancel" (from the form level) aborts. @ @ @Level | Stack at normal exit: | Stack after abort: @2: { final values } | @1: 1. | 0. @ @ @The use of a full-screen CHOOSE program can improve INLIST, @by displaying a full line for each item, @and by using the full height of the screen. @ @ @Full-screen CHOOSE for any HP48G/49G/50G series calculator: @groups.google.com/group/comp.sys.hp48/msg/8888908f27145901?dmode=3Ds= @ource @www.hpcalc.org/details.php?id=3D6431 (ROLDXJ, contains binaries) @ @ @A program INFORML is also provided below, @which accepts the exact same five arguments as INFORM, @but calls INLIST instead, so that you may merely @change INFORM to INFORML in your existing programs that use INFORM. @ @ @A program INLISTF is also provided below, @which accepts the fewer arguments needed by INLIST, @but calls INFORM instead, so that you may merely @change INLIST to INLISTF in existing programs that use INLIST. @ @ @If you require all form fields to be filled in, @to avoid any skipped fields returning NOVAL as their value, @programs INLISTN and INFORMN are also provided, @which accept the identical arguments, but automatically @repeat INLIST or INFORM until the results are free of any NOVAL. @ Sample program for INPROMPT: tinp \<< "Enter X" INPROMPT "X" \->TAG "Enter Y" INPROMPT "Y" \->TAG \>> @ INPROMPT (all HP48/49/50) INPROMPT \<< 10. CHR + "then press menu key" + @ optional hint { { "OK" \<< 0. MENU CONT \>> } { "(AN(L" \<< 0. MENU KILL \>> } } TMENU PROMPT \>> @ --- @ Sample program for INMENU: tinm \<< "Value [menu key]" { X Y } INMENU X "X" \->TAG Y "Y" \->TAG 'X+Y' EVAL "X+Y" \->TAG 'X*Y' EVAL "X*Y" \->TAG \>> @ INMENU (48G/49G/50G) store input to variables instead of stack @ Args: "Title" { labels } Nothing returned on stack. @ "One touch" to store, DONE returns, LeftShift DONE aborts, @ RightShift recalls, RightShift CursorDown reviews values. @ "Real" numbers stored into "unit" objects preserve the units! INMENU \<< { @ the next line is an optional tweak for up to 5 variables { "SHOW" \<< #A300Eh RCLF SIZE 3. < 2. * + LIBEVAL \>> } { "DONE" { \<< 0. MENU CONT \>> \<< 0. MENU KILL \>> } } } + TMENU RCLF SIZE 3. > #25EFFh #151A6h IFTE SYSEVAL PROMPT \>> @ Caution: First back up memory! Incorrect SYSEVALs are harmful! @ Also note the difference between LIBEVAL and SYSEVAL @ --- @ Test program for INLIST[N]: tinl \<< "Test INLIST" { { "Set VX to" 6. } { "Any Number" 0. 28. } "Required field" } { X 123 } DUP INLIST \>> @ or INLISTN to avoid NOVAL @ Note that INFORM would throw an error on type code 28 @ Complete INLIST (in UserRPL) for HP48G/49G/50G INLIST \<< 3. PICK TYPE 2. == { { } SWAP } IFT @ Omitted resets? 3. PICK 1. \<< DROP NOVAL \>> DOSUBS @ Pad values lists 1. DUP2 6. ROLL REPL 4. ROLLD ROT REPL @ To match prompts 0. RCLF { GET DUP TYPE 2. == { 34. CHR SWAP OVER + + } IFT DUP NOVAL SAME { DROP "" } IFT \->STR } RCLMENU \-> h. p. b. a. n. f. c. m. \<< -55. SF 64. STWS STD DO IF h. p. @ Build a new CHOOSE list (showing current values): 1. \<< { } + 1. GET "=" + a. NSUB c. EVAL + NSUB 2. \->LIST \>> DOSUBS { "<DONE>" "[Reset All]" } + 'n.' INCR @ Exit or "reset all" if either was selected: CHOOSE THEN DUP 'n.' STO IF TYPE THEN IF n. " " POS THEN b. 'a.' STO 0. DUP 'n.' STO ELSE a. 1. 1. END ELSE @ Get the prompt and current value for INPUT (editor): p. n. GET { } + 1. GET \->STR a. n. c. EVAL 28. MENU IFERR INPUT "{" SWAP + STR\-> DUP SIZE 1. > { DROP 7. DOERR } @ Reset if null input, halt for CALC if "equal" command: IFT LIST\-> NOT { b. n. GET } IFT { = } OVER POS { DROP DEPTH \->LIST a. n. GET RCLF \-> s. v. g. \<< p. n. GET { } + TAIL DUP SIZE NOT { { ALL } + } IFT "Types" \->TAG f. STOF v. HALT g. STOF DEPTH NOT { v. } IFT DEPTH ROLLD DEPTH 1. - DROPN s. LIST\-> DROP DEPTH ROLL \>> } IFT @ Object type restrictions: DUP NOVAL SAME NOT { p. n. GET { } + TAIL DUP SIZE { 0. ADD OVER TYPE POS NOT { DROP 7. DOERR } IFT } { DROP } IFTE } IFT @ Okay @ 'a.' n. ROT PUT THEN ERRN B\->R { "Invalid object or type" MSGBOX } IFT 'n.' DECR DROP END m. TMENU 0. END ELSE 0. 1. END UNTIL END f. STOF \>> \>> @ Auxiliary programs: @ Loop on INLIST until no undefined value (NOVAL) in results @ [takes the same args as INLIST] INLISTN \<< 3. PICK TYPE 2. == { { } SWAP } IFT 4. ROLLD \-> t. p. b. \<< 1. DO DROP t. p. b. 4. ROLL INLIST DUP DUP { DROP OVER NOVAL POS } IFT UNTIL NOT END \>> \>> @ Loop on INFORM until no undefined value (NOVAL) in results @ [takes the same args as INFORM] INFORMN \<< 5. ROLLD \-> t. p. f. b. \<< 1. DO DROP t. p. f. b. 5. ROLL INFORM DUP DUP { DROP OVER NOVAL POS } IFT UNTIL NOT END \>> \>> @ This takes args for INFORM, but calls INLIST instead INFORML \<< ROT DROP ROT 1. \<< { } + DUP SIZE { DUP HEAD SWAP TAIL TAIL + } { DROP } IFTE \>> DOSUBS ROT ROT INLIST \>> @ This takes args for INLIST, but calls INFORM instead INLISTF \<< 3. PICK TYPE 2. == { { } SWAP } IFT ROT 1. \<< { } + DUP HEAD "" + { "" } + SWAP TAIL + \>> DOSUBS DUP SIZE DUP 4. MIN / CEIL 4. ROLL 4. ROLL INFORM \>> @################################## @# @# Links and todo linksAndTodo " - For programs that are not yet ported in this library (including some testing) at least links to the source may help, as long as the link is valid and the source is reachable (that, as experience shows, is better not to take for granted on internet) - arguments check http://www.hpmuseum.org/forum/thread-7955-post-92718.html#pid92718 - An example of thousands separator http://www.hpmuseum.org/forum/thread-8555-post-92731.html#pid92731 - displaying long text in a 'page' http://www.hpmuseum.org/forum/thread-4635-post-41692.html#pid41692 " END

rpl/start.txt · Last modified: 2018/03/18 02:01 by pier4r