annotate general/funutils/tail.m @ 40:62304c930111

Reversed order of * function composition to match arrow * combinator.
author samer
date Tue, 29 Jan 2013 17:04:40 +0000
parents b1280319413e
children
rev   line source
samer@4 1 % tail1 - Call function with tail recursion
samer@4 2 %
samer@4 3 % tail1 :: (A{1:N}->thunk(B{1:M}), A{1:N} -> B{1:M}.
samer@4 4 %
samer@4 5 % thunk(B{1:M}) ::=
samer@4 6 % exists C{1:L} . cell { C{1:L}->B{1:M}, cell { C{1:L} } }
samer@4 7 % | cell { {0}, cell { B{1:L} } }
samer@12 8 % | void -> B{1:M}.
samer@4 9
samer@4 10 function varargout=feval_tail1(fn,varargin)
samer@4 11 ret=fn(varargin{:});
samer@4 12 if ~isnumeric(ret{1})
samer@4 13 [varargout{1:nargout}]=feval(ret{1},ret{2}{:});
samer@4 14 else
samer@4 15 varargout=ret{2}(1:nargout);
samer@4 16 end
samer@4 17 end
samer@4 18
samer@4 19