Help me with HP50g -DOSUBS ! - Printable Version +- HP Forums (https://www.hpmuseum.org/forum) +-- Forum: HP Calculators (and very old HP Computers) (/forum-3.html) +--- Forum: General Forum (/forum-4.html) +--- Thread: Help me with HP50g -DOSUBS ! (/thread-948.html) |
Help me with HP50g -DOSUBS ! - carlovan - 03-21-2014 09:21 AM I started programming in RPN with the HP33E (1974) and continued up to the HP41C. When I bought the new HP50G I encountered a lot of problems to understand the UserRPN: manuals are not exhaustive ! But the worst came with the command DOSUBS: I really cannot understand how it works: Is there any gentle soul who can write a @comment after every line of the “explanatory example” programs of the RPN Programming manual (!) ? Example 1: { A B C D E } « - » DOSUBS returns { 'A-B' 'B-C' 'C-D' 'D-E' }. Example 2: { A B C } 2 « DUP * * » DOSUBS returns { 'A*(B*B)' 'B*(C*C)' }. Example 3: Entering: { 1 2 3 4 5 } « → a b « CASE 'NSUB==1' THEN a END 'NSUB==ENDSUB' THEN b END 'a+b' EVAL END » » DOSUBS returns { 1 5 7 5 } RE: Help me with HP50g -DOSUBS ! - Dalil - 03-21-2014 12:05 PM Hello, Code: { A B C D E } @ list of element on which the command will be applied What happens is: the command requires 2 arguments (number1 - number2), so for each iteration, the DOSUBS push 2 items onto the stack. What happens at the stack level is, step by step is: Code: 1st iteration before operation: |1st iteration after operation: at this point all items in the list have been used, the resulting list is constructed and output, i.e. the output is Code: {'A-B' 'B-C' 'C-D' 'D-E'} Code: Example 2: Something similar to the previous example happens at the stack level. Code: Example 3: Entering: RE: Help me with HP50g -DOSUBS ! - carlovan - 03-21-2014 05:21 PM nowhere is written that DOSUBS puts the arguments it needs on the stack ! Now I can go on ! Grazie mille (Thanks a lot !) Carlo RE: Help me with HP50g -DOSUBS ! - Gerson W. Barbosa - 03-21-2014 06:32 PM (03-21-2014 05:21 PM)carlovan Wrote: nowhere is written that DOSUBS puts the arguments it needs on the stack ! You should get yourself an HP-48G/GX manual instead: http://h10032.www1.hp.com/ctg/Manual/c00442262.pdf (See page 17-5) Gerson. RE: Help me with HP50g -DOSUBS ! - carlovan - 03-23-2014 10:19 AM Your help has been useful! Those who write the HP manuals must be convinced that people who read them is becoming more and more clever, so progressively are shrinking the explanations ! In the next manual, the explanation of the DOSUBS command will be: "guess how it works" ! |