# NOT RUN {
#Suppose that x is a list of arrays:
a <- array(1,c(2,3,4));
b <- array(2,c(2,3,4));
c <- array(3,c(2,3,4));
d <- array(4,c(2,3,4));
x <- list(a=a,b=b,c=c,d=d)
foo_of_a_List_of_Arrays(x,sum)
foo_of_a_List_of_Arrays(x,mean)
foo_of_a_List_of_Arrays(x,stats::var)
# Note that the component of list can be vectors with fixed same length.
y <- list(c(1,2,3),
c(11,22,33),
c(1111,2222,3333))
a <- foo_of_a_List_of_Arrays(y,sum)
y <- list(c(1,2,3),
c(11,22,33)
)
a <- foo_of_a_List_of_Arrays(y,prod)
# }
Run the code above in your browser using DataLab