array_list_sum Function

private pure function array_list_sum(this, addition)

Arguments

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

Description

Returns a container representing the sum of all items contained in the list. This sum is calculated by repeatedly applying the addition procedure to the list's contents.


Source Code

  pure function array_list_sum(this, addition)
    !* Author: Chris MacMackin
    !  Date: March 2016
    !
    ! Returns a [[container]] representing the sum of all items 
    ! contained in the list. This sum is calculated by repeatedly
    ! applying the addition procedure to the list's contents.
    !
    class(array_list), intent(in) :: this
    procedure(addition_func) :: addition
      !! A procedure performing addition between two [[container]]
      !! objects and returning the result in another container
    class(container), allocatable :: array_list_sum
      !! A container holding the sum of all of the items held within
      !! this list
  end function array_list_sum