view arrows/@loop/loop.m @ 61:eff6bddf82e3 tip

Finally implemented perceptual brightness thing.
author samer
date Sun, 11 Oct 2015 10:20:42 +0100
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