CChris wrote:
>
>
> Problem is that dup() is not documented.
> I assumed that dup() means: push the value pushed last. And in that case, the
> stack should be {30,30,20,10}, not {30,20,10,10}.
> If it was meant to duplicate the top of stack rather, then the test is right
> and my change is not. The pop() test fails because of the discrepancy for dup().
>
dup() should duplicate top(). dup() could be as simple as:
dup() = push(top()) I would keep the length() check in dup() so a meaningful
error message can result in it's misuse.
--
Jeremy Cowgar
http://jeremy.cowgar.com