Mercurial > hg > ishara
annotate sequences/dropwhile.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 s=dropwhile(f,s) |
samer@0 | 2 % drop - Drop elements of sequence that satisfy condition |
samer@0 | 3 % |
samer@0 | 4 % drop :: (A->bool), seq A -> seq A |
samer@0 | 5 |
samer@0 | 6 % if isempty(s) return s; end |
samer@0 | 7 x=head(s); |
samer@0 | 8 while f(x), |
samer@0 | 9 s=next(s); |
samer@0 | 10 if isempty(s), break; end |
samer@0 | 11 x=head(s); |
samer@0 | 12 end |
samer@0 | 13 |
samer@0 | 14 |