% cycler - cycles through input sequence repeatedly
% 
% cycler :: seq(A) -> seq(A).
classdef cycler < seq
	properties (GetAccess=private, SetAccess=private)
		source
		orig
	end
	methods
		function o=cycler(source)
			o.orig=source;
			o.source=source;
		end

		function z=elsize(o), z=elsize(o.source); end
		function s=tostring(o), s=sprintf('cycle(%s)',tostring(o.source)); end
		function x=head(o), x=head(o.source); end
		function o=next(o),
			o.source=next(o.source); 
			if isempty(o.source), o.source=o.orig; end
		end
	end
end
