all tasks

This commit is contained in:
Ingy döt Net 2013-04-11 01:07:29 -07:00
parent b83f433714
commit 68f8f3e56b
14735 changed files with 178959 additions and 0 deletions

View file

@ -0,0 +1,33 @@
class STACK{T} is
private attr stack :LLIST{T};
create:SAME is
res ::= new;
res.stack := #LLIST{T};
return res;
end;
push(elt: T) is
stack.insert_front(elt);
end;
pop: T is
if ~stack.is_empty then
stack.rewind;
r ::= stack.current;
stack.delete;
return r;
else
raise "stack empty!\n";
end;
end;
top: T is
stack.rewind;
return stack.current;
end;
is_empty: BOOL is
return stack.is_empty;
end;
end;