Mercurial > hg > ishara
annotate sequences/@seq/span.m @ 19:1eb0ea29ec40
Doesn't belong here.
author | samer |
---|---|
date | Thu, 17 Jan 2013 13:32:19 +0000 |
parents | 3f77126f7b5f |
children |
rev | line source |
---|---|
samer@3 | 1 function [h,x]=span(f,x) |
samer@3 | 2 % span - divide sequence using a test function |
samer@3 | 3 % |
samer@3 | 4 % span :: (A->bool), seq(A) -> seq(A), seq(A). |
samer@3 | 5 % |
samer@3 | 6 % span(f,x) = takeWhile(f,x), dropWhile(f,x) |
samer@3 | 7 % Will not terminate if head segments turns out to be infinite. |
samer@3 | 8 [Y,x]=spanc(f,x); |
samer@3 | 9 h=cellseq(Y); |