Provides an abstract data type representing a list. This interface provides a derived type with many of the same abilities as lists in higher-level languages such as Python.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(list), | intent(inout) | :: | this | |||
class(*), | intent(in) | :: | item | Item to be appended to list |
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(list), | intent(inout) | :: | this | |||
integer, | intent(in) | :: | element | The index (starting from 1) of the element whose value is to be set. |
||
class(*), | intent(in) | :: | item | The value to store in the specified element |
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(list), | intent(inout) | :: | this | |||
integer, | intent(in), | dimension(:) | :: | elements | The indices (starting from 1) of the elements whose values are to be set. |
|
class(*), | intent(in), | dimension(:) | :: | items | The values to be stored in the specified elements. Each item
is placed in the element specified by the integer in the
corresponding position in the array |
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(list), | intent(inout) | :: | this | |||
procedure(action_sub) | :: | action | A procedure to act on each element of the list |
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(list), | intent(inout) | :: | this | |||
integer, | intent(in) | :: | position | The location at which the new element will be placed |
||
class(*), | intent(in) | :: | item | The value to be placed in the list |
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(list), | intent(inout) | :: | this | |||
class(*), | intent(in) | :: | item | An item, the first occurrence of which will be removed from the list |
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(list), | intent(inout) | :: | this | |||
class(*), | intent(in) | :: | item | An item, the last occurrence of which will be removed from the list |
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(list), | intent(inout) | :: | this | |||
class(*), | intent(in) | :: | item | An item, all occurrences of which will be removed from the list |
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(list), | intent(inout) | :: | this | |||
integer, | intent(in) | :: | element | The position of the element to be deleted from the list |
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(list), | intent(inout) | :: | this | |||
integer, | intent(in), | dimension(:) | :: | element | The positions of the elements to be deleted from the list |
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(list), | intent(inout) | :: | this | |||
integer, | intent(in) | :: | start_element | Index of the first element in the slice to be deleted |
||
integer, | intent(in) | :: | end_element | Index of the last element in the slice to be deleted |
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(list), | intent(inout) | :: | this | |||
procedure(comparison_func) | :: | comparison | A procedure which evaluates whether a container object is less than, equal to, or greater than another |
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(list), | intent(in) | :: | this | |||
class(*), | intent(in) | :: | item |
Position of the first occurrence of item
in list
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(list), | intent(in) | :: | this | |||
class(*), | intent(in) | :: | item |
Position of the last occurrence of item
in list
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(list), | intent(in) | :: | this | |||
class(*), | intent(in) | :: | item |
Positions of the all occurrences of item
in list
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(list), | intent(in) | :: | this | |||
integer, | intent(in) | :: | start_element | The index of the first element in the slice to be returned |
||
integer, | intent(in) | :: | end_element | The index of the last element in the slice to be returned |
A list containing the elements within the slice.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(list), | intent(in) | :: | this | |||
procedure(comparison_func) | :: | comparison | A procedure which evaluates whether a container object is less than, equal to, or greater than another |
The smallest item in the list, as determined by the
comparison
function
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(list), | intent(in) | :: | this | |||
procedure(comparison_func) | :: | comparison | A procedure which evaluates whether a container object is less than, equal to, or greater than another |
The largest item in the list, as determined by the
comparison
function
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(list), | intent(in) | :: | this | |||
class(*), | intent(in) | :: | item | The value which those in the list are being compared to |
||
procedure(subtraction_func) | :: | subtraction | A function determining the magnitude of the difference between two items |
The value from the list which, when passed to subtraction
with item
as the other argument, returns the smallest value
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(list), | intent(in) | :: | this | |||
procedure(addition_func) | :: | addition | A procedure performing addition between two container objects and returning the result in another container |
A container holding the sum of all of the items held within this list
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(list), | intent(in) | :: | this | |||
procedure(test_func) | :: | test | A test for which the values that pass will be returned in a new list |
Contains those items in this list for which test
returns
.true.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(list), | intent(in) | :: | this |
An array of container objects holding the contents of this list
procedure(append_sub), public, deferred :: append | Add an item to the end of the list |
procedure(get_func), public, deferred :: get | Get the item at the specified index |
procedure(set_single_sub), private, deferred :: set_single | Set the specified element to the specified value |
procedure(set_multiple_sub), private, deferred :: set_multiple | Set the specified elements to the specified values |
generic, public :: set => set_single, set_multiple | Set the value of one or more elements in the list |
procedure(get_index_func), public, deferred :: get_index | Get the index of the first occurrence of this item in the list |
procedure(get_last_index_func), public, deferred :: get_last_index | Get the index of the last occurrence of this item in the list |
procedure(get_indices_func), public, deferred :: get_indices | Get the indices of all occurrences of this item in the list |
procedure(slice_func), public, deferred :: slice | Returns a list containing the items with indices in the specified range |
procedure(foreach_sub), public, deferred :: foreach | Perform the provided procedure on each element of the list |
procedure(insert_sub), public, deferred :: insert | Add the item to the specified position in the list, moving all succeeding elements forward by one position |
procedure(remove_sub), public, deferred :: remove | Remove the first occurrence of the specified item from the list |
procedure(remove_last_sub), public, deferred :: remove_last | Remove the last occurrence of the specified item from the list |
procedure(remove_all_sub), public, deferred :: remove_all | Remove the all occurrences of the specified item from the list |
procedure(delete_single_sub), private, deferred :: delete_single | Remove the item from the list at the specified index |
procedure(delete_multiple_sub), private, deferred :: delete_multiple | Remove the items from the list at the specified indices |
procedure(delete_slice_sub), private, deferred :: delete_slice | Remove the items from the list within the specified slice |
generic, public :: delete => delete_single, delete_multiple, delete_slice | Remove one or more elements from the list |
procedure(has_func), public, deferred :: has | Returns |
procedure(sort_sub), public, deferred :: sort | Sorts the list in place using the provided comparison procedure |
procedure(min_func), public, deferred :: min | Returns the smallest item in the list as determined using the provided comparison procedure |
procedure(max_func), public, deferred :: max | Returns the largest item in the list as determined using the provided comparison procedure |
procedure(nearest_func), public, deferred :: nearest | Returns the item in the list for which the provided subtraction procedure returns the smallest absolute value |
procedure(sum_func), public, deferred :: sum | Returns an item representing the sum as determined by iteratively applying the provided addition procedure to all elements in the list |
procedure(filter_func), public, deferred :: filter | Returns a list containing all elements from this list for which
the provided test procedure returns |
procedure(to_array_func), public, deferred :: to_array | Returns an array of containers holding the contents of this list. |
An abstract data type representing a list. This is a fully dynamic means of storing data of a single type and comes with many advanced type-bound procedures for manipulating said data. This derived type aims to provide many of the same features found in lists in higher-level languages such as Python