annotate general/funutils/@function_handle/foldr.m @ 61:eff6bddf82e3 tip

Finally implemented perceptual brightness thing.
author samer
date Sun, 11 Oct 2015 10:20:42 +0100
parents 03694e5c8365
children
rev   line source
samer@13 1 function X=foldr(fn,e,args)
samer@13 2 % foldr - Fold from the right combinator
samer@13 3 %
samer@13 4 % foldr :: (Y,X->X), Y, cells(Y) -> Y.
samer@13 5 %
samer@13 6 % This function applies an associative operator to a list of arguments,
samer@13 7 % starting from the right, eg
samer@13 8 % elements, eg foldr(@plus,0,{1,2,3,4}) = (1+(2+(3+(4+0)))).
samer@13 9 X=e; for i=length(args):-1:1, X=fn(args{i},X); end