the last grand rename

This commit is contained in:
Andrey Parhomenko 2024-05-19 23:19:55 +05:00
parent c280608f8d
commit 1ba2779261
12 changed files with 35 additions and 31 deletions

3
btest.sh Executable file
View file

@ -0,0 +1,3 @@
#!/bin/sh
#
go build -o ./exe/ ./cmd/*

View file

@ -2,7 +2,7 @@ package main
import ( import (
"fmt" "fmt"
"vultras.su/core/gods/lists" "surdeus.su/core/gods/lists"
"strings" "strings"
) )

View file

@ -1,7 +1,7 @@
package main package main
import ( import (
"vultras.su/core/gods/maps" "surdeus.su/core/gods/maps"
"fmt" "fmt"
) )

4
go.mod
View file

@ -1,5 +1,5 @@
module vultras.su/core/gods module surdeus.su/core/gods
go 1.21 go 1.21
require golang.org/x/exp v0.0.0-20230213192124-5e25df0256eb // indirect require golang.org/x/exp v0.0.0-20230213192124-5e25df0256eb

View file

@ -1,4 +1,4 @@
package iterx package iters
// The type describes pair of key and value. // The type describes pair of key and value.
type Pair[K any, V any] struct { type Pair[K any, V any] struct {

View file

@ -1,4 +1,4 @@
package iterx package iters
// Implementing the interface lets us iterate through the // Implementing the interface lets us iterate through the
// the data by lightweight channels. // the data by lightweight channels.

View file

@ -1,4 +1,4 @@
package iterx package iters
func ChanToSlice[V any](c chan V) []V { func ChanToSlice[V any](c chan V) []V {
ret := []V{} ret := []V{}

View file

@ -1,8 +1,8 @@
package lists package lists
import ( import (
"vultras.su/core/gods" "surdeus.su/core/gods"
"vultras.su/core/gods/stacks" "surdeus.su/core/gods/stacks"
) )
// The interface all the lists must implement. // The interface all the lists must implement.

View file

@ -1,7 +1,7 @@
package lists package lists
import ( import (
"vultras.su/core/gods" "surdeus.su/core/gods"
"sort" "sort"
"fmt" "fmt"
) )

View file

@ -2,7 +2,7 @@ package maps
import ( import (
"fmt" "fmt"
"vultras.su/core/gods" "surdeus.su/core/gods"
) )
// Generic map interface for all the maps. // Generic map interface for all the maps.

View file

@ -1,7 +1,7 @@
package rangex package ranges
import ( import (
"github.com/mojosa-software/godat/src/iterx" "surdeus.su/core/gods/iters"
cnts "golang.org/x/exp/constraints" cnts "golang.org/x/exp/constraints"
) )
@ -18,29 +18,30 @@ func New[V cnts.Ordered](start, step, end V) *Range[V] {
} }
} }
func (r *Range[V]) Chan() iterx.PairChan[int, V] { func (r *Range[V]) Chan() iters.PairChan[int, V] {
less := func(a, b V) bool {
return a < b
}
more := func(a, b V) bool {
return a > b
}
var compare func(a, b V) bool
start, step, end := r.start, r.step, r.end start, step, end := r.start, r.step, r.end
c := make(iterx.PairChan[int, V]) if start < end {
compare = less
} else {
compare = more
}
c := make(iters.PairChan[int, V])
go func(){ go func(){
var compare func(a, b V) bool
less := func(a, b V) bool {
return a < b
}
more := func(a, b V) bool {
return a > b
}
if start < end {
compare = less
} else {
compare = more
}
j := 0 j := 0
for i := start ; compare(i, end) ; i += step { for i := start ; compare(i, end) ; i += step {
c <- iterx.Pair[int, V]{ c <- iters.Pair[int, V]{
K:j, K:j,
V:i, V:i,
} }

View file

@ -1,7 +1,7 @@
package stacks package stacks
import ( import (
"vultras.su/core/gods" "surdeus.su/core/gods"
) )
type Stack[V any] interface { type Stack[V any] interface {