Post Reply 
All about lists
10-20-2018, 03:54 PM (This post was last modified: 10-20-2018 05:17 PM by sasa.)
Post: #1
All about lists
The official manual seems do not provide any details about lists. It is quite obvious that CONCAT is not enough. As well, limit about size seems to be not specified, as well as resizing...

Let take, for example, following:
Code:

export SZ_List_T2()
begin
  print();

  local a := {};
  print(a);
 
  local i := 1; 
  repeat
   
    a[0] := i;
    print(a);    
    i := i + 1;

  until i == 5;

  print(" ");

  print ("After: print a[0]");
  print(a[0]);
  print(" ");

  print ("After: a[10] := 10");
  a[10] := 10;
  print(a);
  print(" ");

  print ("After: a[10000] := 10000");
  a[10000] := 10000;
  print("Size: " + size(a));
  print(" ");

  print("After: print a[0]");
  print(a[0]);

  print ("After: a[10001] := 2");
  a[10001] := 2;
  print("Size: " + size(a));
  print(" ");

  print("After: print a[0]");
  print(a[0]);

  print ("FINISHED!");
  editlist(a);
end;

As results show, it is now clear than enlarging list is possible simply by assigning data in desired index, while all gaps are filled with zero values. With zero index is possible to show last and adding new item. However, a command to delete an item from list as well seems to missing, requiring additional code to accomplish it.

If assign item with index over the limit, "Insufficient memory" error will be raised. However, in upper example (using terminal screen), program execution stops without any notice.

Furthermore, if execute EDITLIST wilth list contain 10000 items and then try to insert new row, latest public beta emulator silently terminates (at least on Linux). I would be interested what would happen on real calculator...

Some unofficial details are based on:
https://tiplanet.org/hpwiki/index.php?ti...bout_Lists
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
All about lists - sasa - 10-20-2018 03:54 PM
RE: All about lists - pier4r - 10-20-2018, 05:54 PM
RE: All about lists - sasa - 10-20-2018, 06:49 PM
RE: All about lists - Joe Horn - 10-20-2018, 09:01 PM
RE: All about lists - sasa - 10-20-2018, 11:01 PM
RE: All about lists - Tim Wessman - 10-21-2018, 10:56 AM
RE: All about lists - Giancarlo - 10-21-2018, 01:06 PM



User(s) browsing this thread: 1 Guest(s)