Compare commits
3 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
7d930b6e97
|
|||
|
6721658a8e
|
|||
|
ec772d7bbc
|
2
map.go
2
map.go
@@ -1,4 +1,4 @@
|
||||
package laniakea
|
||||
package extypes
|
||||
|
||||
type HashMap[K comparable, V any] map[K]V
|
||||
|
||||
|
||||
10
slice.go
10
slice.go
@@ -1,4 +1,4 @@
|
||||
package laniakea
|
||||
package extypes
|
||||
|
||||
import "slices"
|
||||
|
||||
@@ -50,12 +50,12 @@ func (s Slice[T]) Pop(index int) Slice[T] {
|
||||
if index == 0 {
|
||||
return s[1:]
|
||||
}
|
||||
out := make(Slice[T], s.Len()-index)
|
||||
out := make(Slice[T], 0, s.Len()-1)
|
||||
for i, e := range s {
|
||||
if i == index {
|
||||
continue
|
||||
}
|
||||
out[i] = e
|
||||
out = append(out, e)
|
||||
}
|
||||
return out
|
||||
}
|
||||
@@ -132,12 +132,12 @@ func (s Set[T]) Pop(index int) Set[T] {
|
||||
if index == 0 {
|
||||
return s[1:]
|
||||
}
|
||||
out := make(Set[T], s.Len()-index)
|
||||
out := make(Set[T], 0, s.Len()-1)
|
||||
for i, e := range s {
|
||||
if i == index {
|
||||
continue
|
||||
}
|
||||
out[i] = e
|
||||
out = append(out, e)
|
||||
}
|
||||
return out
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user