>>107894574
>or OCaml
class ['a] stack (st : 'a array) =
object (self)
val mutable depth = 0
method is_empty = depth = 0
method is_full = depth = Array.length st
method pop =
assert (not self#is_empty);
depth <- depth - 1;
st.(depth)
method push x =
assert (not self#is_full);
Comment too long. Click here to view the full text.