[slang-users] SLANGFUN and arrays .....

John E. Davis davis at space.mit.edu
Wed Jul 6 10:58:49 EDT 2005


Paul Boekholt <p.boekholt at hetnet.nl> wrote:
>Or use a list.  From the manual:

  Right.  One advantage of the list over the array is that an element
may be easily inserted/appended at any position using the list_insert
and list_append functions.  Elements may be removed using the
list_delete and list_pop functions.  

  At the moment, lists do not support support "slices", i.e., one cannot
use

   even_elements = list[[0::2]];
   odd_elements = list[[1::2]];

to create lists from the even and odd elements of the list.  If you
need such a feature, then an array may be more appropriate.
Eventually, lists will support the slicing operation.

--John




More information about the slang-users-l mailing list