annotate general/cellutils/cfoldr.m @ 53:3ba80c9914ff

Minor doc fix, added .class to .hgignore
author samer
date Mon, 02 Feb 2015 10:47:55 +0000
parents 03694e5c8365
children
rev   line source
samer@13 1 function X=foldr(fn,e,args)
samer@13 2 % foldr - Fold from the right for cell arrays
samer@13 3 %
samer@13 4 % This function applies an operator to a list of arguments,
samer@13 5 % starting from the right, eg
samer@13 6 % elements, eg foldr(@plus,0,{1,2,3,4}) = (1+(2+(3+(4+0)))).
samer@13 7 %
samer@13 8 % foldr ::
samer@13 9 % (Y,X->X) ~'associative binary operator',
samer@13 10 % Y ~'initial element',
samer@13 11 % {[N]->Y} ~'list (cell array) of arguments'
samer@13 12 % -> Y.
samer@13 13 X=e; for i=length(args):-1:1, X=fn(args{i},X); end