% tail_feval - Call function with tail recursion
% 
% tail_feval :: (A{1:N}->rthunk(B{1:M}), A{1:N} -> B{1:M}.
%
% rthunk(B{1:M}) ::= 
%    exists C{1:L} . cell { C{1:L} -> rthunk(B{1::}), C{1:L} }.
%  | cell { {0}, cell { B{1:L} } }
function varargout=tail_feval(fn,varargin)
	ret=fn(varargin{:});
	while ~isnumeric(ret{1})
		ret=feval(ret{1},ret{2}{:}); 
	end
	varargout=ret{2}(1:nargout); 
end
			
			
