Create empy list on 38g/39g/40g



#2

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.


#3

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


#4

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


#5

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.

#6

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


Possibly Related Threads...
Thread Author Replies Views Last Post
  HP-Prime : Extracting elements from a list in RPN Miguel Toro 0 1,219 11-15-2013, 06:44 PM
Last Post: Miguel Toro
  [HP-Prime] Picking elements from a List in a program Jean-Michel 3 1,535 11-15-2013, 04:16 AM
Last Post: dg1969
  Hp PRIME - how to send a list to the connectivity Kit giancarlo 1 980 11-10-2013, 11:50 AM
Last Post: Tim Wessman
  How do I decompose a list with the HP Prime. Hal Bitton in Boise 4 1,587 11-08-2013, 02:07 PM
Last Post: Patrice
  How to create a touch button [HP Prime] uklo 1 1,035 11-02-2013, 02:03 PM
Last Post: Marcus von Cube, Germany
  HP-Prime/Xcas: vector/list indexing fhub 6 2,271 10-27-2013, 04:52 PM
Last Post: fhub
  Hp prime list function - indexing into a list Andy B (Australia) 3 1,542 10-07-2013, 01:41 AM
Last Post: cyrille de Brébisson
  [HP-Prime CAS] list[x,y,z], vector[x, y, z ] ... data type operation? CompSystems 1 970 08-22-2013, 03:30 PM
Last Post: Joe Horn
  HP 50G List of Library numbers already in use? Michael Lopez 2 1,003 08-04-2013, 10:10 PM
Last Post: Michael Lopez
  [HP -Prime CAS] List, Matrix, Vector as one Array? CompSystems 0 810 07-26-2013, 05:22 PM
Last Post: CompSystems

Forum Jump: