function length = length(self)
length = 0;
node = self.stack_pointer;
while ~isempty(node)
  length = length + 1;
  node = next(node);
end
end