8 lines
185 B
Text
8 lines
185 B
Text
def map(func, collection) {
|
|
def output := [].diverge()
|
|
for item in collection {
|
|
output.push(func(item))
|
|
}
|
|
return output.snapshot()
|
|
}
|
|
println(map(square, array))
|