function g=flip(f)
% flip - Flip order of first two arguments to a function
%
% flip :: (A,B->C) -> (B,A->C).

if isa(f,'func'), 
	g=perm(f,[2,1]);
else
	if nargin(f)==2, f=@(a,b)f(b,a);
	else f=@(a,b,varargin)f(b,a,varargin{:});
	end
end

