function g=ge(f,nout)
	if nargin<2, nout=nargout(f); end
	if nout<0, error('function must have a definite number of outputs'); end
	if nargin(f)==1, g=@h1; else g=@hn; end
	function rets=h1(x), [rets{1:nout}]=f(x); end
	function rets=hn(varargin), [rets{1:nout}]=f(varargin{:}); end
end
