view arrows/@loop/loop.m @ 11:8eec969fd4d3

Not used.
author samer
date Mon, 14 Jan 2013 15:52:31 +0000
parents 672052bd81f8
children
line wrap: on
line source
% 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