view arrows/delay.m @ 61:eff6bddf82e3 tip

Finally implemented perceptual brightness thing.
author samer
date Sun, 11 Oct 2015 10:20:42 +0100
parents 672052bd81f8
children
line wrap: on
line source
% delay - arrow implementing a delay line
%
% delay ::
%    W:natural   ~'width of buffer',
%    A           ~'a value to pad delay line with'
% -> arrow({[[N,1]->A]}, {[[N,1]->A]}, {[W]->[[N]->A]}).

function a=delay(n,pad)
	a=loop(@delayfn,@(sz)repmat({repmat(pad,sz)},1,n));
	function [out,buf]=delayfn(in,buf)
		out=buf{1};
		buf=[buf(2:end),{in}];
	end
end