12 lines
185 B
Go
12 lines
185 B
Go
|
package wrong
|
||
|
|
||
|
import "golang.org/x/exp/constraints"
|
||
|
|
||
|
func Scale[S ~[]E, E constraints.Integer](s S, c E) S {
|
||
|
r := make(S, len(s))
|
||
|
for i, v := range s {
|
||
|
r[i] = v * c
|
||
|
}
|
||
|
return r
|
||
|
}
|