The Museum of HP Calculators

HP Forum Archive 14

[ Return to Index | Top of Index ]

APPLY command
Message #1 Posted by Matteo Miglioranzi on 11 Aug 2004, 7:34 a.m.

Hello. I have a problem with this simple user prog. (hp49g, rom 1.19.6):

<< 1 4 FOR I I 1 ->LIST F APPLY NEXT >>

It doesn't work but if you debug it, you get the right answer (obviously the debug can't be the solution). Is it necessary to use WHILE or REPEAT routines or this program can work also with FOR..NEXT (maybe with some tricks)?

Thank you

      
Re: APPLY command
Message #2 Posted by James M. Prange on 13 Aug 2004, 4:21 a.m.,
in response to message #1 by Matteo Miglioranzi

Quote:
Hello. I have a problem with this simple user prog. (hp49g, rom 1.19.6):
<<
  1 4
  FOR I
    I 1 ->LIST
    F APPLY
  NEXT
>>

Note that I edited that quote to apply preformatted code.

Maybe you want:

%%HP: T(3);
\<<
  1 4
  FOR I
    I 1 \->LIST
    'F' APPLY
  NEXT
\>>
Note the ' marks quoting the F.

But I'm really not sure what you want to accomplish. What are the expected results?

Quote:
It doesn't work but if you debug it, you get the right answer (obviously the debug can't be the solution).
Are you using the 49G's built-in debugger, or do you mean "debugging" it mentally? What do you mean by "doesn't work"? Does it error out, or does it return unexpected results?
Quote:
Is it necessary to use WHILE or REPEAT routines or this program can work also with FOR..NEXT (maybe with some tricks)?
FOR...NEXT seems to me the most obvious method, although I suppose that I could come up with a program using WHILE...REPEAT...END if I cared to put some effort into it.

Regards,
James

            
Re: APPLY command
Message #3 Posted by Matteo Miglioranzi on 13 Aug 2004, 12:22 p.m.,
in response to message #2 by James M. Prange

Hello.

F is a variable in which nothing is stored (VAR menu doesn't contain F variable) but even if you put 'F' instead of F, you obtain the same error message: NEXT error, bad argument type. The answer should be:

4: F(1) 3: F(2) 2: F(3) 1: F(4)

With DEBUG capabilities of hp49 you can see the above exact answer without any error.

Thank you.

Matteo Miglioranzi

                  
Re: APPLY command
Message #4 Posted by juergen Rodenkirchen (GER) on 13 Aug 2004, 5:13 p.m.,
in response to message #3 by Matteo Miglioranzi

Hi Matteo!

I tried your program with the 48GX and it returned the predicted result 1: 'F(4)' 2: 'F(3)' 3: 'F(2)' 4: 'F(1)'! Unlike my 49G (with Rom version 1.19-6) which comes up with the error you reported; so, it seems to me that you've uncovered a bug in the FOR NEXT routine of the 49G ROM ...

Regards, Juergen


[ Return to Index | Top of Index ]

Go back to the main exhibit hall