% loop - Looping feedback arrow for stateful arrows.
%
% loop ::
%    (A, S -> B, S)  ~'function to map input and state to output and next state',
%    (size -> S0:S)  ~'function to map size of input to initial state'
% -> arrow({A},{B},S) ~'arrow from A to B with state of type S'.

function o=loop(fn,s0)
	if nargin<1, fn=@(a,b)deal(a,b); s0=[]; end
	s.fn=fn; s.s0=s0;
	o=class(s,'loop',arrow(1,1));
end

