% foldrcols - fold array columns from the right
%
% foldrcols :; 
%    ([[M]], [[N]] -> [[M]])   ~'folding function',
%    [[M]]                     ~'initial value',
%    [[N,L]]                   ~'data to scan, sequence of length L'
% -> [[M]].

function y=foldrcols(f,y,X,varargin)
	for i=size(X,2):-1:1, y=f(y,X(:,i)); end
end
	

