()
| 7 | type stack []Item |
| 8 | |
| 9 | func (s stack) String() string { |
| 10 | res := "stack{" |
| 11 | for i, it := range s { |
| 12 | if i != 0 { |
| 13 | res += ", " |
| 14 | } |
| 15 | res += it.String() |
| 16 | } |
| 17 | res += "}" |
| 18 | return res |
| 19 | } |
| 20 | |
| 21 | func (s *stack) peek(n int64) (Item, bool) { |
| 22 | index := int64(len(*s)) - 1 - n |