array_list_filter Function

private pure function array_list_filter(this, test)

Arguments

Type IntentOptional AttributesName
class(array_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.

Description

Returns a new list containing only those items held in this list which pass the provided test.


Source Code

  pure function array_list_filter(this, test)
    !* Author: Chris MacMackin
    !  Date: March 2016
    !
    ! Returns a new list containing only those items held in this list
    ! which pass the provided test.
    !
    class(array_list), intent(in) :: this
    procedure(test_func) :: test
      !! A test for which the values that pass will be returned in a
      !! new list
    class(list), allocatable :: array_list_filter
      !! Contains those items in this list for which `test` returns
      !! `.true.`
  end function array_list_filter