Differences

This shows you the differences between two versions of the page.

reference:lp0504 [2010/01/17 22:00]
don
reference:lp0504 [2010/01/31 14:46] (current)
don
Line 13: Line 13:
-  append a, 1 +=== Example: === 
-  append a, 2 +  append a, 1                   // a = {1) 
-  append a, 3 +  append a, 2                   // a = {1,2) 
-   +  append a, 3                   // a = {1,2,3)
-  put a      // displays {1,2,3}+
===== INSERT ===== ===== INSERT =====
Line 31: Line 30:
  = value   = value
  : Any value or expression   : Any value or expression
 +
 +=== Notes: ===
 +The new entry is inserted into the array at the position specified.  All entries from the next position are moved to make room for the new entry.
 +
 +If the index value is less than the origin, the new entry is inserted at the beginning of the array.
 +
 +If the index value is greater than the range, it is treated as an append and the new entry is added at the end of the array.
 +
 +=== Example: ===
 +  a = {1,2,3}                    // a = {1,2,3)
 +  insert a, 1, 99                // a = {99,1,2,3}
 +  insert a, 0, 88                // a = {88,99,1,2,3}
 +  insert a, 10, 77              // a = {88,99,1,2,3,77}
 + 
 +
===== DELETE ===== ===== DELETE =====
Line 57: Line 71:
  : the upper bound of this array.   : the upper bound of this array.
-=== Processing: ===+=== Notes: ===
By default the lower bound of an array is always 1. By default the lower bound of an array is always 1.
Line 66: Line 80:
If RANGE is used to resize an existing array, any elements outside the bounds will be deleted.  Any new elements created will be empty.  All other elements will remain unchanged. If RANGE is used to resize an existing array, any elements outside the bounds will be deleted.  Any new elements created will be empty.  All other elements will remain unchanged.
-=== Examples: ===+=== Example: ===
  range v1(-4 to 7)   range v1(-4 to 7)
  range v2(1 to 2, 3 to 4)   range v2(1 to 2, 3 to 4)

reference/lp0504.txt · Last modified: 2010/01/31 14:46 by don