Mercurial > hg > ishara
annotate sequences/split.m @ 0:672052bd81f8
Initial partial import.
author | samer |
---|---|
date | Wed, 19 Dec 2012 22:38:28 +0000 |
parents | |
children |
rev | line source |
---|---|
samer@0 | 1 function [h,t]=split(dim,n,s) |
samer@0 | 2 % split - gather first n elements and return with rest of sequence |
samer@0 | 3 % |
samer@0 | 4 % split :: D:natural, N:natural, seq A -> [[N]->A], seq A |
samer@0 | 5 |
samer@0 | 6 h=[]; |
samer@0 | 7 for i=1:n, x=head(s); h=cat(dim,h,x); s=next(s); end |
samer@0 | 8 t=s; |
samer@0 | 9 |
samer@0 | 10 |
samer@0 | 11 |