3 Commits

Author SHA1 Message Date
7d930b6e97 fix Pop method 2026-02-04 12:56:22 +03:00
6721658a8e v1.0.2 2026-02-04 12:46:35 +03:00
ec772d7bbc v1.0.1 2026-02-04 12:44:03 +03:00
4 changed files with 8 additions and 8 deletions

2
go.mod
View File

@@ -1,3 +1,3 @@
module git.nix13.pw/scuroneko/extypes
go 1.25.6
go 1.25

2
map.go
View File

@@ -1,4 +1,4 @@
package laniakea
package extypes
type HashMap[K comparable, V any] map[K]V

View File

@@ -1,4 +1,4 @@
package laniakea
package extypes
import (
"errors"

View File

@@ -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
}