summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDimitri Sokolyuk <demon@dim13.org>2015-04-05 17:18:05 +0200
committerDimitri Sokolyuk <demon@dim13.org>2015-04-05 17:18:05 +0200
commit231e2367fc520c9bbfcb7e3c21bb0a65f6b63f9b (patch)
tree1ec0d3410a54074a5d38f72dac81aff8bc467896
parente31bf70c44c85559d5743fdd645ba6936b83c49d (diff)
Make it a bit faster
-rw-r--r--stack.go4
1 files changed, 1 insertions, 3 deletions
diff --git a/stack.go b/stack.go
index eb9b6be..33c8357 100644
--- a/stack.go
+++ b/stack.go
@@ -19,9 +19,7 @@ func (s *Stack) Push(v Value) {
// Insert inserts value at head
func (s *Stack) Insert(v Value) {
- *s = append(*s, 0)
- copy((*s)[1:], (*s)[:len(*s)-1])
- (*s)[0] = v
+ *s = append(Stack{v}, *s...)
}
// Pop retrieves value from tail