% amatrix - arrow to generate sequence by scanning through an array
%
% amatrix :: [[N,M]] -> arrow({},{[[N]]},1..M).
function o=amatrix(X)
	state=1;
	len=size(X,2);
	o=unfolder(@sfn1,state);

	function [x,S]=sfn(S)
		x=X(:,S);
		S=1+mod(S,len);
	end

	function [x,S]=sfn1(S)
		if S>len, error('ARROW:EOF','End of arrow sequence'); end
		x=X(:,S);
		S=S+1;
	end
end
