Skip to content
Snippets Groups Projects
stack.m 588 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:
%   q  = stack    - Default constructor, empty stack table
%
% example:
%   q = stack 
%   q = push(q, [1:2])
%   q = push(q, ones(1,5))
%   element = pop(q)
%   q = push(q, zeros(1,3))
%   etc ...
%
% $Id$

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

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