Mercurial > hg > ishara
view arrows/@loop/loop.m @ 0:672052bd81f8
Initial partial import.
author | samer |
---|---|
date | Wed, 19 Dec 2012 22:38:28 +0000 |
parents | |
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