This module contains strategies for working on lists using indexes.An indexed list works similarly to an array in that every element ofthe list is associated with in an integer index, and the first element has index 1.
Adding the indices to a list is done by add-indices.
Strategy details
|
ATerm
|
add-indices
|
Adds indices to the elements of a list.The index of the first element is 1.
Example: <add-indices> [1,2,3] => [(1,1),(2,2),(3,3)]
type
|
List(a) -> List((Int, a))
|
|
|
ATerm
|
at-index(Strategy s)
|
Apply s at the specified indexThe first element has index 0.
type
|
(Int, List(a)) -> List(a)
|
|
|
ATerm
|
at-index(Strategy s, ATerm i)
|
Apply s at the specified index i.The first element has index 0.
|
|
ATerm
|
at-index-tail(Strategy s, ATerm i)
|
Apply s to the list containing the elementsfrom index i onwards from the original list.The first element has index 0.
|
|
ATerm
|
get-index
|
Get index of element in list.
|
|
ATerm
|
index
|
Get the n-th element of a list.The first element has index 1.
|
|
ATerm
|
index(ATerm i)
|
Get the i-th element of a list.The first element has index 1.
|
|
ATerm
|
insert
|
Insert element in list.
type
|
(Int, a, List(a)) -> List(a)
|
|
|
ATerm
|
map-with-index(Strategy s)
|
File
|
index.str
|
Author
|
unknown
|
Since
|
unknown
|
|
Parameters
|
Apply strategies that require some knowledge of the index of an element to the elements of the list.
The index of the first element is 1.
|
|
ATerm
|
nmap(Strategy s, ATerm i)
|
File
|
index.str
|
Author
|
unknown
|
Since
|
unknown
|
|
Parameters
Strategy
s
|
Strategy to apply to all the elements of the list.
|
ATerm
i
|
The first index (e.g. 0 or 1)
|
|
Map a strategy over a list where the strategy takes the index as a term argument.
|
|
ATerm
|
set-index
|
Change element in list.The first element has index 0.
type
|
(Int, a, List(a)) -> List(a)
|
|
|