list_mod Module

module~~list_mod~~UsesGraph module~list_mod list_mod module~deque_mod deque_mod module~deque_mod->module~list_mod module~abstract_container_mod abstract_container_mod module~abstract_container_mod->module~list_mod module~abstract_container_mod->module~deque_mod module~ordered_mod ordered_mod module~abstract_container_mod->module~ordered_mod module~iterator_mod iterator_mod module~abstract_container_mod->module~iterator_mod module~iterable_mod iterable_mod module~abstract_container_mod->module~iterable_mod module~queue_mod queue_mod module~queue_mod->module~deque_mod module~ordered_mod->module~queue_mod module~iterator_mod->module~ordered_mod module~iterator_mod->module~iterable_mod module~countable_mod countable_mod module~countable_mod->module~ordered_mod module~iterable_mod->module~ordered_mod module~iterable_mod->module~countable_mod iso_fortran_env iso_fortran_env iso_fortran_env->module~abstract_container_mod
Help

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.

Used By

module~~list_mod~~UsedByGraph module~list_mod list_mod module~array_list_mod array_list_mod module~list_mod->module~array_list_mod module~multimap_mod multimap_mod module~array_list_mod->module~multimap_mod module~data_set_mod data_set_mod module~array_list_mod->module~data_set_mod module~dictionary_mod dictionary_mod module~array_list_mod->module~dictionary_mod module~data_set_mod->module~dictionary_mod module~dynamic_set_mod dynamic_set_mod module~data_set_mod->module~dynamic_set_mod module~dictionary_mod->module~multimap_mod module~map_mod map_mod module~dictionary_mod->module~map_mod module~multiset_mod multiset_mod module~dynamic_set_mod->module~multiset_mod module~map_mod->module~multimap_mod
Help

Abstract Interfaces

abstract interface

  • private subroutine append_sub(this, item)

    Arguments

    Type IntentOptional AttributesName
    class(list), intent(inout) :: this
    class(*), intent(in) :: item

    Item to be appended to list

abstract interface

  • private subroutine set_single_sub(this, element, item)

    Arguments

    Type IntentOptional AttributesName
    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

abstract interface

  • private subroutine set_multiple_sub(this, elements, items)

    Arguments

    Type IntentOptional AttributesName
    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 elements.

abstract interface

  • private subroutine foreach_sub(this, action)

    Arguments

    Type IntentOptional AttributesName
    class(list), intent(inout) :: this
    procedure(action_sub) :: action

    A procedure to act on each element of the list

abstract interface

  • private subroutine insert_sub(this, position, item)

    Arguments

    Type IntentOptional AttributesName
    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

abstract interface

  • private subroutine remove_sub(this, item)

    Arguments

    Type IntentOptional AttributesName
    class(list), intent(inout) :: this
    class(*), intent(in) :: item

    An item, the first occurrence of which will be removed from the list

abstract interface

  • private subroutine remove_last_sub(this, item)

    Arguments

    Type IntentOptional AttributesName
    class(list), intent(inout) :: this
    class(*), intent(in) :: item

    An item, the last occurrence of which will be removed from the list

abstract interface

  • private subroutine remove_all_sub(this, item)

    Arguments

    Type IntentOptional AttributesName
    class(list), intent(inout) :: this
    class(*), intent(in) :: item

    An item, all occurrences of which will be removed from the list

abstract interface

  • private subroutine delete_single_sub(this, element)

    Arguments

    Type IntentOptional AttributesName
    class(list), intent(inout) :: this
    integer, intent(in) :: element

    The position of the element to be deleted from the list

abstract interface

  • private subroutine delete_multiple_sub(this, element)

    Arguments

    Type IntentOptional AttributesName
    class(list), intent(inout) :: this
    integer, intent(in), dimension(:):: element

    The positions of the elements to be deleted from the list

abstract interface

  • private subroutine delete_slice_sub(this, start_element, end_element)

    Arguments

    Type IntentOptional AttributesName
    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

abstract interface

  • private subroutine sort_sub(this, comparison)

    Arguments

    Type IntentOptional AttributesName
    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

abstract interface

  • private pure function get_func(this, element)

    Arguments

    Type IntentOptional AttributesName
    class(list), intent(in) :: this
    integer, intent(in) :: element

    The index (starting from 1) of the element to return

    Return Value class(container), allocatable

    The item with index element

abstract interface

  • private pure function get_index_func(this, item)

    Arguments

    Type IntentOptional AttributesName
    class(list), intent(in) :: this
    class(*), intent(in) :: item

    Return Value integer

    Position of the first occurrence of item in list

abstract interface

  • private pure function get_last_index_func(this, item)

    Arguments

    Type IntentOptional AttributesName
    class(list), intent(in) :: this
    class(*), intent(in) :: item

    Return Value integer

    Position of the last occurrence of item in list

abstract interface

  • private pure function get_indices_func(this, item)

    Arguments

    Type IntentOptional AttributesName
    class(list), intent(in) :: this
    class(*), intent(in) :: item

    Return Value integer, dimension(:),allocatable

    Positions of the all occurrences of item in list

abstract interface

  • private function slice_func(this, start_element, end_element)

    Arguments

    Type IntentOptional AttributesName
    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

    Return Value class(list), allocatable

    A list containing the elements within the slice.

abstract interface

  • private elemental function has_func(this, item)

    Arguments

    Type IntentOptional AttributesName
    class(list), intent(in) :: this
    class(*), intent(in) :: item

    A value whose presence in the list is being checked for

    Return Value logical

    .true. if item is present in list, .false. otherwise

abstract interface

  • private pure function min_func(this, comparison)

    Arguments

    Type IntentOptional AttributesName
    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

    Return Value class(container), allocatable

    The smallest item in the list, as determined by the comparison function

abstract interface

  • private pure function max_func(this, comparison)

    Arguments

    Type IntentOptional AttributesName
    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

    Return Value class(container), allocatable

    The largest item in the list, as determined by the comparison function

abstract interface

  • private pure function nearest_func(this, item, subtraction)

    Arguments

    Type IntentOptional AttributesName
    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

    Return Value class(container), allocatable

    The value from the list which, when passed to subtraction with item as the other argument, returns the smallest value

abstract interface

  • private pure function sum_func(this, addition)

    Arguments

    Type IntentOptional AttributesName
    class(list), intent(in) :: this
    procedure(addition_func) :: addition

    A procedure performing addition between two container objects and returning the result in another container

    Return Value class(container), allocatable

    A container holding the sum of all of the items held within this list

abstract interface

  • private pure function filter_func(this, test)

    Arguments

    Type IntentOptional AttributesName
    class(list), intent(in) :: this
    procedure(test_func) :: test

    A test for which the values that pass will be returned in a new list

    Return Value class(list), allocatable

    Contains those items in this list for which test returns .true.

abstract interface

  • private pure function to_array_func(this)

    Arguments

    Type IntentOptional AttributesName
    class(list), intent(in) :: this

    Return Value class(container), dimension(:),allocatable

    An array of container objects holding the contents of this list


Derived Types

type, public, abstract, extends(deque) :: list

Type-Bound Procedures

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 .true. if the specified item is present in the list.

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 .true.

procedure(to_array_func), public, deferred :: to_array

Returns an array of containers holding the contents of this list.

Description

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