PickN copies the item N items back in the stack to the top. Stack transformation: PickN(0): [x1 x2 x3] -> [x1 x2 x3 x3] PickN(1): [x1 x2 x3] -> [x1 x2 x3 x2] PickN(2): [x1 x2 x3] -> [x1 x2 x3 x1]
(n int32)
| 321 | // PickN(1): [x1 x2 x3] -> [x1 x2 x3 x2] |
| 322 | // PickN(2): [x1 x2 x3] -> [x1 x2 x3 x1] |
| 323 | func (s *stack) PickN(n int32) error { |
| 324 | so, err := s.PeekByteArray(n) |
| 325 | if err != nil { |
| 326 | return err |
| 327 | } |
| 328 | s.PushByteArray(so) |
| 329 | |
| 330 | return nil |
| 331 | } |
| 332 | |
| 333 | // RollN moves the item N items back in the stack to the top. |
| 334 | // |