Hi community,
I try to use slice of any to imitate the tuple type,
and use this function to compare two slices: a, b.
How can I improve it?
Thanks
```
package tuple2
func Cmp(a, b []any) (int, bool) {
for i := 0; i != min(len(a), len(b)); i++ {
if a[i] == nil && b[i]
Hi community,
I have got this now.
It handles only built-in types: string, int, float64.
The tuples (slices) should be the same size.
Type of elements in same position should be the same.
I still need help on this:
The part involves cmp.Compare repeates three times for string, int, float64.
I
I add nested tuple (slice) support:
a := []any{"abc", 123, 3.14, 100, []any{"abc", 123, 3.14, 100}}
b := []any{"abc", 123, 3.14, 100, []any{"abc", 123, 3.14, 100}}
c, ok := tuple2.Cmp(a, b)
fmt.Println(c, ok)
```
package tuple2
import (
"cmp"
"reflect"
)
func Cmp
Hi community,
In my little example:
if server reads first, then writes;
client must writes first, then read;
then client must performs the operations in reverse order as server,
or both server and client will block.
In C++ boost.asio, the order of calls to async_read, async_write
does not ma
Hi,
I updated code like this. now I can use the same handleConnection both server
and client, the only difference is the content of message which is read or
written.
```
func handleConnection(conn net.Conn) {
defer conn.Close()
msgID := 0
reader := bufio.NewReader(
updated.
the order of calls to read and write does not matter, read and write will not
block each other.
the same handleConnection function can be used on both server and client sides.
the only difference is the message content which is read and written.
```
func handleConnection(conn net.C
Hi community,
The type of yield occurs twice in the function declaration and
at the return statement.
```
func (s *Set[E]) All() iter.Seq[E] {
return func(yield func(E) bool) {
for v := range s.m {
if !yield(v) {
return
}
}
}
}
Hi,
Do you mean that if the new Yield types are in the iter package,
it can be used after that?
```
type Yield[V any] func(V) bool
type Yield2[K comparable, V any] func(K, V) bool
type Seq[E any] func(Yield[E])
type Seq2[K comparable, V any] func(Yield2[K, V])
// not importing iter, so can
Are there alternatives to lower & upper bound or partition_point
Suppose there duplicate entries in a slice.
I need to use a loop to find out the upper bound on a sorted slice.
Are there something similar to c++ lower_bound, upper_bound, partition_point?
Thanks
```
package main
import