From 544a3f376371750d97e1b17d01d4e522946c2f9d Mon Sep 17 00:00:00 2001 From: Julien Dessaux Date: Sat, 20 Aug 2022 09:25:57 +0200 Subject: Fixed stack duplicate behaviour --- src/stack.nim | 4 ++-- 1 file 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 -- cgit v1.2.3