annotate arrows/@loop1/loop1.m @ 6:0ce3c2070089

Removed duplicate code and fixed doc in timed_action.
author samer
date Mon, 14 Jan 2013 14:33:37 +0000
parents 672052bd81f8
children 5de03f77dae1
rev   line source
samer@0 1 % loop1 - Looping feedback arrow for stateful arrows.
samer@0 2 %
samer@0 3 % loop1 ::
samer@0 4 % N:natural ~'number of inputs for this arrow',
samer@0 5 % M:natural ~'number of outputs for this arrow',
samer@0 6 % ({[N]->size} -> ([A:arglist(N), {S}] -> [B:arglist(M), {S}]))
samer@0 7 % ~'function to map input sizes to state transformer',
samer@0 8 % ({[N]->size} -> S0:S) ~'function to map size of input to initial state'
samer@0 9 % -> arrow(A,B,S) ~'arrow from A to B with state of type S'.
samer@0 10
samer@0 11 function o=loop1(nin,nout,initfn)
samer@0 12 if nargin<1,
samer@0 13 nin=1; nout=1;
samer@0 14 initfn=@(sz)deal(@(a,b)deal(a,b),[]);
samer@0 15 end
samer@0 16 s.init=initfn;
samer@0 17 s.nin=nin;
samer@0 18 s.nout=nout;
samer@0 19 o=class(s,'loop1',arrow(nin,nout));
samer@0 20 end
samer@0 21