Mercurial > hg > ishara
annotate sequences/@seq/split_gather.m @ 61:eff6bddf82e3 tip
Finally implemented perceptual brightness thing.
author | samer |
---|---|
date | Sun, 11 Oct 2015 10:20:42 +0100 |
parents | 3f77126f7b5f |
children |
rev | line source |
---|---|
samer@3 | 1 function [h,t]=split(dim,n,s) |
samer@3 | 2 % split - gather first n elements and return with rest of sequence |
samer@3 | 3 % |
samer@3 | 4 % split :: D:natural, N:natural, seq A -> [[N]->A], seq A |
samer@3 | 5 |
samer@3 | 6 % !! prevent array growth |
samer@3 | 7 h=[]; |
samer@3 | 8 for i=1:n, x=head(s); h=cat(dim,h,x); s=next(s); end |
samer@3 | 9 t=s; |
samer@3 | 10 |
samer@3 | 11 |
samer@3 | 12 |