annotate general/funutils/@function_handle/foldr.m @ 22:4f5015db91aa
Moved maxnormalise to unitmax
author |
samer |
date |
Thu, 17 Jan 2013 14:23:21 +0000 |
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
|