The Museum of HP Calculators

HP Forum Archive 20

[ Return to Index | Top of Index ]

Create empy list on 38g/39g/40g
Message #1 Posted by Kiyoshi Akima on 24 Oct 2011, 2:30 p.m.

This is such a simple question, but I can't find an answer in the manual.

How do I, under program control, create an empty list, or else initialize an existing list (of arbitrary size) to empty? I know how to do it from the keyboard by going into the VAR menu, selecting the list, and pressing [DEL]. (By "program" I mean HP-BASIC, not SysRPL.)

I'm trying to get a program to initialize itself to a known state, which requires an empty list to which it can add things as it goes.

      
Re: Create empy list on 38g/39g/40g
Message #2 Posted by Eddie W. Shore on 24 Oct 2011, 3:20 p.m.,
in response to message #1 by Kiyoshi Akima

{ } -> L# should do it. (where # is 0-9)

            
Re: Create empy list on 38g/39g/40g
Message #3 Posted by Kiyoshi Akima on 24 Oct 2011, 3:25 p.m.,
in response to message #2 by Eddie W. Shore

Nope. {} gives a syntax error, with or without a space between the braces.

                  
Re: Create empy list on 38g/39g/40g
Message #4 Posted by Eddie W. Shore on 25 Oct 2011, 9:02 a.m.,
in response to message #3 by Kiyoshi Akima

Quote:
Nope. {} gives a syntax error, with or without a space between the braces.

I got the same thing. MAKELIST requires a sequence - I can't imagine a way to create an empty list.

I have a feeling that empty lists aren't possible on the 38g/39g/40g.

Possible workaround (?):

Initialize the list with {1} and delete the "first 1" at the end program execution

{1} -> L1
** commands to add elements to L1 
Result:  L1 = {1, #, #, ...}
**
SUB L1; L1; 2; SIZE(L1)

Result: L1={#, #, #, ...}

SUB - CMDS-Matrix menu SIZE - MATH-List menu

I hope this helps.

Eddie

Edited: 25 Oct 2011, 9:10 a.m.

      
Re: Create empy list on 38g/39g/40g
Message #5 Posted by M. Joury on 25 Oct 2011, 10:03 a.m.,
in response to message #1 by Kiyoshi Akima

If you have an empty list (via DEL in the LIST menu then you can do the following:

Say L9 is empty and you want to make L1 empty: L9>L1:

HTH

Cheers,

Marwan


[ Return to Index | Top of Index ]

Go back to the main exhibit hall