% accumstats - arrow that collects 1st and 2nd order statistics (cell version)
%
% accumstats :: arrow({[[N]]},{stats_cell},stats_cell).
%
% stats_cell ::= cell { nonneg, [[N]], [[N,N]] }.

function a=accumstats
	a=loop(@accum,@(s){0,0,0});
end

function [y,s2]=accum(x,s), 
	s2={s{1}+size(x,1),s{2}+sum(x,2),s{3}+x*x'};
	y=s2;
end
