home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The C Users' Group Library 1994 August
/
wc-cdrom-cusersgrouplibrary-1994-08.iso
/
listings
/
v_08_07
/
8n07071b
< prev
next >
Wrap
Text File
|
1990-06-19
|
591b
|
34 lines
\end{verbatim}
Stack : (T:Type) -> Type is
uses
Boolean
ops
push : T -> nil
pre
isfull.not
post
isempty.not
done
pop : nil -> T
pre
isempty.not
post
isfull.not
done
isempty : nil -> Boolean
isfull : nil -> Boolean
const
s0 : Stack(T)
eqn # this is a comment
# push and pop are inverse to each other
'pop( 'push( s, x)) iseq (s, x)
'push( 'pop( s)) iseq s
# there is a unique empty stack value
'isempty( s0) iseq TRUE
'isempty( s) => s iseq s0
done