有没有一种方法可以在切片的所有元素上应用函数? [关闭]

How do I apply a function to all elements of go slice without having to explicitly iterate over the slice?

Is there something similar to Java

stream().map(<fn>) https://docs.oracle.com/javase/8/docs/api/java/util/stream/Stream.html#map-java.util.function.Function-

(OR)

forEach(<fn>) https://docs.oracle.com/javase/8/docs/api/java/lang/Iterable.html#forEach-java.util.function.Consumer-

Yes, but in a typical Go way, not a typical Java way:

for _, elem := range mySlice {
    fn(elem)
}

Go is built on a foundation of simplicity - its lack of features and "sugar" is itself a feature of the language.