% seqbase - Base class for sequences
%
% seqbase :: 
%    Size:[[1,D]], 	~ size of item type,
%    (seq(A) -> A).
%    (seq(A) -> seq(A) | empty),
%    (seq(A) -> string)
% -> seq([Size->_]) ~'sequence of things of size Size'.
classdef seqbase < seq
	properties (GetAccess=private, SetAccess=immutable)
		sz
		headfn
		nextfn
		stringfn
	end
	methods
		function o=seqbase(size,headfn,nextfn,stringfn)
			o.sz    =size;
			o.headfn=headfn;
			o.nextfn=nextfn;
			o.stringfn=stringfn;
		end

		function x=head(a), x=a.headfn(a); end
		function b=next(a), b=a.nextfn(a); end
		function s=tostring(d), s=d.stringfn(d); end
		function s=elsize(a), s=sz; end
	end
end

