summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Buetow <paul@buetow.org>2023-04-09 14:37:30 +0300
committerPaul Buetow <paul@buetow.org>2023-04-09 14:37:30 +0300
commit198ceb7a3c1a6cb4416e861320c4a7c8033f2deb (patch)
treea8e5b3aef4418cb9f44143e42dcca7de49fd4027
parent7621e57eafb7b9d818c15763b52efb92d3dfaaaa (diff)
move types to types.go
-rw-r--r--ds/arraylist.go9
-rw-r--r--ds/types.go13
2 files changed, 13 insertions, 9 deletions
diff --git a/ds/arraylist.go b/ds/arraylist.go
index de27832..f2616c7 100644
--- a/ds/arraylist.go
+++ b/ds/arraylist.go
@@ -4,17 +4,8 @@ import (
"fmt"
"math/rand"
"strings"
- "golang.org/x/exp/constraints"
)
-type Integer interface {
- constraints.Integer
-}
-
-type Number interface {
- constraints.Integer | constraints.Float
-}
-
type ArrayList[V Number] []V
func NewArrayList[V Number](l int) ArrayList[V] {
diff --git a/ds/types.go b/ds/types.go
new file mode 100644
index 0000000..3dfe0b3
--- /dev/null
+++ b/ds/types.go
@@ -0,0 +1,13 @@
+package ds
+
+import (
+ "golang.org/x/exp/constraints"
+)
+
+type Integer interface {
+ constraints.Integer
+}
+
+type Number interface {
+ constraints.Integer | constraints.Float
+}