lib-stackrng
A collection of routines designed for handling "ranges". A "range" is a set of related items with a
integer 'count' of them on the top. For example: "bat" "cat" "dog" 3. The output result of "explode" is a range.
Below, "offset" is how many stack items are between range and the parameters (e.g. how deep in the stack is the
range?). "pos" represents the position within the range you are working with (e.g. the 4th item in the range, etc.).
"e;num" represents how many of the range's items you wish to manipulate.
| sr-extractrng | [ {rng} ... offset num pos -- {rng'} ... {subrng} ] |
pulls a subrange out of a range buried in the stack, removing them. |
| sr-copyrng | [ {rng} ... offset num pos -- {rng} ... {rng} ] |
copies a subrange out of a range buried in the stack. |
| sr-deleterng | [ {rng} ... offset num pos -- {rng'} ] |
deletes a subrange from a range buried on the stack. |
| sr-insertrng | [ {rng1} ... {rng2} offset pos -- {rng} ] |
inserts a subrange into the middle of a buried range on the stack. |
| sr-filterrng | [ {rng} funcaddr -- {rng'} {filtrdrng} ] |
Takes the given range and tests each item with the given filter function address. The function takes a single data value
and returns an integer. If the integer is non-zero, it pulls that data item out of the range and puts it into the filtered
range. The data items can be of any type.
|
| sr-catrng | [ {rng1} {rng2} -- {rng} ] | concatenates two ranges into one range. |
| sr-poprng | [ {rng} -- ] | removes a range from the stack. |
| sr-swaprng | [ {rng1} {rng2} -- {rng2} {rng1} ] | takes two ranges on the stack and swaps them. |
feaelin@kemenel.org
lib-strackrng / Revised 2004 March 31 22:06 (Wednesday)
© 2004 Iain E. Davis
|