annotate sequences/@seq/diffwith.m @ 8:f0a3d7d7a0e3

Renamed cat_sep function to catsep
author samer
date Mon, 14 Jan 2013 14:54:10 +0000
parents 3f77126f7b5f
children b1280319413e
rev   line source
samer@3 1 function Y=diffwith(F,X)
samer@3 2 % diffwith - Generalised diff using argbitrary binary function
samer@3 3 %
samer@3 4 % diffwith :: (A,A->B), seq A -> seq B.
samer@3 5 %
samer@3 6 % The given function gets called with the current value as the
samer@3 7 % first arguments and the previous value as the second.
samer@3 8
samer@3 9 Y=mapaccum(@diffst,next(X),head(X));
samer@3 10 function [y,s]=diffst(x,s)
samer@3 11 y=F(x,s);
samer@3 12 s=x;
samer@3 13 end
samer@3 14 end
samer@3 15