Shorter package names.
This commit is contained in:
parent
34e21699a3
commit
d88c3112bd
17 changed files with 10 additions and 148 deletions
|
@ -1,19 +1,14 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"github.com/mojosa-software/godat/src/llx"
|
||||
|
||||
"fmt"
|
||||
"github.com/mojosa-software/godat/llx"
|
||||
)
|
||||
|
||||
func main() {
|
||||
ll := llx.New[string]("zero", "one", "two", "three", "four", "five")
|
||||
|
||||
ll.Push("-one", "-two")
|
||||
|
||||
ll.Swap(0, 2)
|
||||
|
||||
for el := range ll.Chan() {
|
||||
fmt.Println(el)
|
||||
}
|
||||
fmt.Println(ll.Slice())
|
||||
}
|
||||
|
|
@ -2,8 +2,8 @@ package iterx
|
|||
|
||||
// Implementing the interface lets us iterate through the
|
||||
// the data by lightweight channels.
|
||||
type Channeler[K any, V any] interface {
|
||||
Chan() PairChan[K, V]
|
||||
type Channeler[V any] interface {
|
||||
Chan() chan V
|
||||
}
|
||||
|
||||
// Implementing the interface provides the way to
|
8
mkfile
8
mkfile
|
@ -1,5 +1,7 @@
|
|||
<mkconfig
|
||||
<$MKINCDIR/gobuild
|
||||
all: build
|
||||
build:V:
|
||||
go build -o ./exe/ ./cmd/...
|
||||
|
||||
<$MKINCDIR/w3/run-dev
|
||||
clean:V:
|
||||
rm -f ./exe/*
|
||||
|
||||
|
|
|
@ -1,26 +0,0 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"github.com/mojosa-software/godat/src/poolx"
|
||||
|
||||
"fmt"
|
||||
)
|
||||
|
||||
func main() {
|
||||
values := []string{
|
||||
"zero", "one",
|
||||
"should be deleted",
|
||||
"two", "three",
|
||||
}
|
||||
pool := poolx.New[string]()
|
||||
for _, v := range values {
|
||||
pool.Append(v)
|
||||
}
|
||||
|
||||
pool.DeleteValue("should be deleted")
|
||||
|
||||
for p := range pool.Chan() {
|
||||
fmt.Println(p.K, p.V)
|
||||
}
|
||||
}
|
||||
|
|
@ -1,23 +0,0 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"github.com/mojosa-software/godat/src/sparsex"
|
||||
"fmt"
|
||||
)
|
||||
|
||||
func main() {
|
||||
unord := sparsex.New[int, string](true)
|
||||
unord.Set(1, "suck")
|
||||
unord.Set(-5, "cock")
|
||||
unord.Set(-4, "die")
|
||||
unord.Set(-1000, "withme")
|
||||
|
||||
for p := range unord.Chan() {
|
||||
fmt.Println(p.K, p.V)
|
||||
}
|
||||
|
||||
unord.Sort()
|
||||
for p := range unord.Chan() {
|
||||
fmt.Println(p.K, p.V)
|
||||
}
|
||||
}
|
|
@ -1,86 +0,0 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
//"github.com/mojosa-software/godat/src/mapx"
|
||||
//"github.com/mojosa-software/godat/src/slicex"
|
||||
//"github.com/mojosa-software/godat/src/poolx"
|
||||
"github.com/mojosa-software/godat/src/rangex"
|
||||
"github.com/mojosa-software/godat/src/mapx"
|
||||
"fmt"
|
||||
)
|
||||
|
||||
type Struct struct {
|
||||
Name string
|
||||
Value int
|
||||
}
|
||||
|
||||
type MyMap struct {
|
||||
mapx.Map[string, int]
|
||||
}
|
||||
|
||||
func NewMyMap() *MyMap {
|
||||
return &MyMap{
|
||||
Map: mapx.New[string, int](),
|
||||
}
|
||||
}
|
||||
|
||||
func main() {
|
||||
rangex.New[float32](0, .001, 0.050).Chan().ForEach(
|
||||
func(i int, v float32) bool {
|
||||
fmt.Println(i, v)
|
||||
return true
|
||||
},
|
||||
)
|
||||
|
||||
m := mapx.New[string, int]()
|
||||
m.Set("suck", 1)
|
||||
m.Set("cock", 10)
|
||||
|
||||
for k, v := range m {
|
||||
fmt.Println(k, v)
|
||||
}
|
||||
|
||||
fmt.Println(m.Has("dick"))
|
||||
|
||||
mm := NewMyMap()
|
||||
mm.Set("dicker", 15)
|
||||
|
||||
fmt.Println(mm.Get("dicker"))
|
||||
/*m := map[string] string {
|
||||
"Key1" : "Value1",
|
||||
"Key2" : "Value2",
|
||||
"Key3" : "Value3",
|
||||
}
|
||||
m1 := map[int] string {
|
||||
1 : "Val1",
|
||||
2 : "Val2",
|
||||
7 : "Val7",
|
||||
}
|
||||
s := []Struct {
|
||||
{"Name1", 1},
|
||||
{"Name2", 2},
|
||||
}
|
||||
|
||||
fmt.Println(m)
|
||||
fmt.Println(slicex.MakeMap(
|
||||
s,
|
||||
func(s []Struct, i int) string {
|
||||
return s[i].Name
|
||||
},
|
||||
))
|
||||
|
||||
fmt.Printf("%q\n", mapx.Keys(m))
|
||||
fmt.Printf("%q\n", mapx.Values(m))
|
||||
fmt.Printf("%q\n", mapx.Reverse(m))
|
||||
fmt.Printf("%v\n", mapx.Reverse(m1))
|
||||
|
||||
ll := poolx.New[int]()
|
||||
ll.Append(0)
|
||||
ll.Append(1)
|
||||
ll.Append(2)
|
||||
ll.Del(256)
|
||||
ll.Del(1)
|
||||
for p := range ll.Range() {
|
||||
fmt.Println(p)
|
||||
}*/
|
||||
}
|
Loading…
Reference in a new issue