Skip to content
Snippets Groups Projects
stack.m 635 B
Newer Older
function s = stack
%STACK constructor for stack object
% stack is a data structure based on the principle of 
% Last In First Out (LIFO)
%
% usage:
%   s  = stack    - Default constructor, empty stack table
%
% example:
%   s = stack 
%   s = push(q, [1:2])
%   s = push(q, ones(1,5))
%   s = pop(s)
%   e = element(s)
%   s = push(s, zeros(1,3))
%   e = top(s)
%   etc ...
%
% $Id$

% ----------------
if nargin == 0  
  self.stack_pointer = {};
else
  error('stack:stack', 'Invalid arguments.');
end

% class constructor
% -----------------
s = class(self,'stack');