% loop1 - Looping feedback arrow for stateful arrows.
%
% loop1 ::
%    N:natural  ~'number of inputs for this arrow',
%    M:natural  ~'number of outputs for this arrow',
%    ({[N]->size} -> ([A:arglist(N), {S}] -> [B:arglist(M), {S}])) 
%                           ~'function to map input sizes to state transformer',
%    ({[N]->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=loop1(nin,nout,initfn)
	if nargin<1, 
		nin=1; nout=1;
		initfn=@(sz)deal(@(a,b)deal(a,b),[]); 
	end
	s.init=initfn; 
	s.nin=nin;
	s.nout=nout;
	o=class(s,'loop1',arrow(nin,nout));
end

