% lt - select inputs to function
%
% lt :: (A{1:N}=>B{:}), I:[[N]->natural] -> (C{:}=>B{:}) :- C(I)==A(1:N).
%
% f<[i,j,k...] is a function which takes any number of arguments
% but passes only the ith,jth,kth etc arguments to f, returning
% any values from f.

function g=lt(f,I)
	if nargout(f)==1, g=@q1; else g=@qn; end

	function x=q1(varargin)
		x=f(varargin{I});
	end
	function varargout=qn(varargin)
		[varargout{1:nargout}]=f(varargin{I});
	end
end
