fdoc

subroutinemake_zipprivate

subroutine make_zip(c, args, v)

zip(...), as a list of tuples.

Arguments

NameTypeIntentAttributesDescription
ctype(fypp_t)inout

the state

argstype(value_t)indimension(:)

the arguments

vtype(value_t)out

the result

Calls

Source

Show the code
subroutine make_zip(c, args, v)
    type(fypp_t), intent(inout) :: c            !! the state
    type(value_t), intent(in) :: args(:)        !! the arguments
    type(value_t), intent(out) :: v             !! the result
    integer :: n, k, j

    v%kind = V_LIST
    n = huge(n)
    do k = 1, size(args)
        if (args(k)%kind /= V_LIST .and. args(k)%kind /= V_TUPLE) then
            call fail(c, 'zip takes lists and tuples')
            return
        end if
        n = min(n, size(args(k)%items))
    end do
    if (size(args) == 0) n = 0
    allocate (v%items(n))
    do k = 1, n
        v%items(k)%kind = V_TUPLE
        allocate (v%items(k)%items(size(args)))
        do j = 1, size(args)
            v%items(k)%items(j) = args(j)%items(k)
        end do
    end do
end subroutine make_zip

Graphs

Calls

Called by