hi:
this is only an idea, hope it's useful.
no `T`, only `type` as `types`.
```go
type Inter int8,int16,int32,int64
func Less(a,b Inter)bool{
return a<b
}
// and
type UInter uint8,uint16,uint32,uint64
type Float float32,float64
type Number Inter,Uinter,Float
func Less(a,b Number)bool{
return a<b
}
func Abs(n Number)Number{
if n<0{return -n}
return n
}
func Map(s []Number, f func(Number)Number)[]Number{
r := make([]Number, len(s))
for i, v := range s {
r[i] = f(v)
}
return r
}
// sorter
type Sorter Number,string
func Sort(list []Sorter){
// ...
}
// even with interface
type Some interface{String()},string
```
--
You received this message because you are subscribed to the Google Groups
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/golang-nuts/d8cb3242-4c7f-40ae-a46a-be5464615e56n%40googlegroups.com.