This is a replacement for [array]. I extended [array] to have some features of map (I like having items in order and sortable, but like the way you can store and search for values within a map. This is a bridge between the two). It adds other member tags to the array type, like ->random and ->roundrobin. The latter is great for creating alternating rows within a table, just assign it two or more colors and cycle through them in your looping container.
[lp_array] has the following addtional member tags:
setindex - sets the pointer for roundrobin and reverserobin ->(setindex: 5) ->(setindex: 'first') ->(setindex:'last')
getindex - gets the pointer for roundrobin and reverserobin ->(getindex)
roundrobin - returns the next item in the array, wraps to the first element after the last element. ->(roundrobin)
reverserobin - returns the previous item in the array, wraps to the last element before the first element ->(reverserobin)
random - returns a random element from the array ->(random)
popfirst - returns the first element from the array and removes it from the array ->(popfirst)
poplast - returns the last element from the array and removes it from the array ->(poplast)
poprandom - returns a random element from the array and removes it from the array ->(poprandom)
pushfirst - inserts an element into the array at the beginning of the array ->(pushfirst: 'abc')
pushlast - inserts an element into the array at the end of the array ->(pushlast:'xyz')
pushrandom - inserts the element into a random place within the array ->(pushrandom:'lmn')
join - similar to ->join params: join - what to join the elements with front - what to prepend to the joined string back - what to append to the joined string first - what to join the first two elements with last - what to join the last two elements with ->(join: ', ',-last=' and ')
keys - works like map->keys when the array contains pairs ->(keys)
values - returns the values for all pairs within the array ->(values)
removepair - removes a pair element given a key ->(removepair:'car')
insertpair - inserts a pair element, works like map->insert by overwriting any existing pair with the same key ->(insertpair: (pair: 'car' = 'edsel'))
findpair - works like map->find, returns the value given a key ->(findpair: 'car')
findvalue - same as findpair ->(findvalue:'car')
findkeys - returns all keys from pairs containing the value given ->(findkeys:'edsel')
Click the "Download" button below to retrieve a copy of this tag,
including the complete documentation and sample usage shown
on this page. Place the downloaded ".inc" file in your
LassoStartup folder, restart Lasso, and you can begin using this
tag immediately.