File | index.str |
Author | unknown |
Since | unknown |
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.
General | |
Lines of code | 166 |
Stratego | |
Module number | 1 (100% documented) |
Constructor number | 0 |
Overlay number | 0 |
Strategy number | 12 (91% documented) |
Rule number | 6 (100% documented) |
DynamicRule number | 0 |
Strategy summary |
||
add-indices | Adds indices to the elements of a list | index.str |
at-index(Strategy s) | Apply s at the specified index The first element has index 0 | index.str |
at-index(Strategy s, ATerm i) | Apply s at the specified index i | index.str |
at-index-tail(Strategy s, ATerm i) | Apply s to the list containing the elements from index i onwards from the original list | index.str |
get-index | Get index of element in list | index.str |
get-index0(Strategy s) | n/a | index.str |
index | Get the n-th element of a list | index.str |
index(ATerm i) | Get the i-th element of a list | index.str |
insert | Insert element in list | index.str |
map-with-index(Strategy s) | Apply strategies that require some knowledge of the index of an element to the elements of the list | index.str |
nmap(Strategy s, ATerm i) | Map a strategy over a list where the strategy takes the index as a term argument | index.str |
set-index | Change element in list | index.str |
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)]
|
|||||||||||||||||
ATerm | at-index(Strategy s) | ||||||||||||||||
Apply s at the specified indexThe first element has index 0.
|
|||||||||||||||||
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.
|
|||||||||||||||||
ATerm | map-with-index(Strategy s) | ||||||||||||||||
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) | ||||||||||||||||
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.
|
|||||||||||||||||