samer@0: function [h,t]=split(dim,n,s) samer@0: % split - gather first n elements and return with rest of sequence samer@0: % samer@0: % split :: D:natural, N:natural, seq A -> [[N]->A], seq A samer@0: samer@0: h=[]; samer@0: for i=1:n, x=head(s); h=cat(dim,h,x); s=next(s); end samer@0: t=s; samer@0: samer@0: samer@0: