annotate 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
rev   line source
samer@0 1 % loop - Looping feedback arrow for stateful arrows.
samer@0 2 %
samer@0 3 % loop ::
samer@0 4 % (A, S -> B, S) ~'function to map input and state to output and next state',
samer@0 5 % (size -> S0:S) ~'function to map size of input to initial state'
samer@0 6 % -> arrow({A},{B},S) ~'arrow from A to B with state of type S'.
samer@0 7
samer@0 8 function o=loop(fn,s0)
samer@0 9 if nargin<1, fn=@(a,b)deal(a,b); s0=[]; end
samer@0 10 s.fn=fn; s.s0=s0;
samer@0 11 o=class(s,'loop',arrow(1,1));
samer@0 12 end
samer@0 13