% 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
