summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Buetow <paul@buetow.org>2026-05-24 00:15:04 +0300
committerPaul Buetow <paul@buetow.org>2026-05-24 00:15:04 +0300
commit11272232772fcfa20f15e12efe37aad580ab3d8c (patch)
tree944e6c9b9eaca32dd5533b28db6702bed2e46299
parent5883d15e7cef6e0cfa95a2fde273877890296378 (diff)
docs(rpn): fix Values() comment — correct order from top-to-bottom to bottom-to-top
Values() returns slices.Clone(s.values) which preserves push order (bottom at index 0, top at last index). The existing comment contradicted both the implementation and the test documentation.
-rw-r--r--internal/rpn/stack.go2
1 files changed, 1 insertions, 1 deletions
diff --git a/internal/rpn/stack.go b/internal/rpn/stack.go
index 6032a37..a0af494 100644
--- a/internal/rpn/stack.go
+++ b/internal/rpn/stack.go
@@ -51,7 +51,7 @@ func (s *Stack) Len() int {
return len(s.values)
}
-// Values returns a copy of all stack values (top-to-bottom order).
+// Values returns a copy of all stack values (bottom-to-top order).
func (s *Stack) Values() []StackValue {
return slices.Clone(s.values)
}