Mercurial > hg > ishara
annotate sequences/diffwith.m @ 2:7357e1dc2ad6
Simplified scheduler library with new schedule representation.
author | samer |
---|---|
date | Sat, 22 Dec 2012 16:17:51 +0000 |
parents | 672052bd81f8 |
children |
rev | line source |
---|---|
samer@0 | 1 function Y=diffwith(F,X) |
samer@0 | 2 % diffwith - Generalised diff using argbitrary binary function |
samer@0 | 3 % |
samer@0 | 4 % diffwith :: (A,A->B), seq A -> seq B. |
samer@0 | 5 % |
samer@0 | 6 % The given function gets called with the current value as the |
samer@0 | 7 % first arguments and the previous value as the second. |
samer@0 | 8 |
samer@0 | 9 Y=sfndata(@diffst,head(X),next(X)); |
samer@0 | 10 |
samer@0 | 11 function [y,s]=diffst(x,s) |
samer@0 | 12 y=F(x,s); |
samer@0 | 13 s=x; |
samer@0 | 14 end |
samer@0 | 15 end |
samer@0 | 16 |