Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(array_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
Returns the value contained in the list for which the subtraction
function returns the smallest absolute real number when comparing
with the specified item
.
pure function array_list_nearest(this, item, subtraction)
!* Author: Chris MacMackin
! Date: March 2016
!
! Returns the value contained in the list for which the subtraction
! function returns the smallest absolute real number when comparing
! with the specified `item`.
!
class(array_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
class(container), allocatable :: array_list_nearest
!! The value from the list which, when passed to `subtraction`
!! with `item` as the other argument, returns the smallest value
end function array_list_nearest