view general/funutils/flip.m @ 42:ae596261e75f

Various fixes and development to audio handling
author samer
date Tue, 02 Dec 2014 14:51:13 +0000
parents fbc0540a9208
children
line wrap: on
line source
function g=flip(f)
% flip - Flip order of first two arguments to a function
%
% flip :: (A,B->C) -> (B,A->C).
% flip :: (A,B,D{1:N}->C) -> (B,A,D{1:N}->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