samer@0: % delay - arrow implementing a delay line samer@0: % samer@0: % delay :: samer@0: % W:natural ~'width of buffer', samer@0: % A ~'a value to pad delay line with' samer@0: % -> arrow({[[N,1]->A]}, {[[N,1]->A]}, {[W]->[[N]->A]}). samer@0: samer@0: function a=delay(n,pad) samer@0: a=loop(@delayfn,@(sz)repmat({repmat(pad,sz)},1,n)); samer@0: function [out,buf]=delayfn(in,buf) samer@0: out=buf{1}; samer@0: buf=[buf(2:end),{in}]; samer@0: end samer@0: end