aboutsummaryrefslogtreecommitdiff
path: root/src/stack.nim
diff options
context:
space:
mode:
Diffstat (limited to 'src/stack.nim')
-rw-r--r--src/stack.nim4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/stack.nim b/src/stack.nim
index d6493a3..ef7edf8 100644
--- a/src/stack.nim
+++ b/src/stack.nim
@@ -46,8 +46,8 @@ func Clear*(s: var Stack) =
s.height = 0
func Duplicate*(s: var Stack) =
- if s.height > 0:
- s.Push(s.data[s.height-1])
+ let v = s.Pop()
+ s.PushVector((v, v));
func Swap*(s: var Stack) =
let a = s.Pop