function h=funseq(varargin)
% funseq - Constructs sequential application of several functions
%
% h=funseq(f,...,g)
%
% returns the function h such that h(...) = g(...) but
% all functions are evaluated in order.

	fns=varargin;
	h=@seq;

	function varargout=seq(varargin)
		for i=1:length(fns)-1
			feval(fns{i},varargin{:});
		end
		if nargout==0,
			feval(fns{end},varargin{:});
		else
			[varargout{1:nargout}]=feval(fns{end},varargin{:});
		end
	end
end
