Mercurial > hg > ishara
view sequences/@seq/foldl.m @ 36:9e7be347b3a0
Renamed sequence classes to avoid clashes with seq methods;
Fixed default slicing dimension while retaining behaviour of window.m;
Updated use of sequences in dsp/synth.
author | samer |
---|---|
date | Thu, 24 Jan 2013 14:51:23 +0000 |
parents | 03694e5c8365 |
children | beb8a3f4a345 |
line wrap: on
line source
function x=foldl(fn,e,y,varargin) % foldl - Fold combinator for sequences % % This function applies an associative operator to a list of arguments, % starting from the left using the given starting element. % % foldl :: % (X,Y->X) ~'associative binary operator', % X ~'initial element', % seq(Y) ~'a lazy sequence' % -> X. if iscell(y), x=cfoldl(fn,e,y); return; end if nargin<4, x=e; while ~isempty(y) x=fn(x,head(y)); y=next(y); end else opts=prefs('quiet',1,varargin{:}); x=e; while ~isempty(y) x=fn(x,head(y)); y=next(y); if ~opts.quiet, fprintf('.'); end optpause(opts); end end