function foreach(f,X,varargin)
% foreach - do an action for each element in a cell array in order
%
% foreach :: (A->action), {[N]->A} -> action.
% foreach :: (A->action), {[N]->A}, options {} -> action.
%
% Takes the same options as iterate.

	iterate(@g,X,varargin{:});

	function x=g(x)
		f(x{1});
		x=x(2:end);
	end
end
