samer@0: % loop - Looping feedback arrow for stateful arrows. samer@0: % samer@0: % loop :: samer@0: % (A, S -> B, S) ~'function to map input and state to output and next state', samer@0: % (size -> S0:S) ~'function to map size of input to initial state' samer@0: % -> arrow({A},{B},S) ~'arrow from A to B with state of type S'. samer@0: samer@0: function o=loop(fn,s0) samer@0: if nargin<1, fn=@(a,b)deal(a,b); s0=[]; end samer@0: s.fn=fn; s.s0=s0; samer@0: o=class(s,'loop',arrow(1,1)); samer@0: end samer@0: