mirror of
https://github.com/aNNiMON/Own-Programming-Language-Tutorial.git
synced 2024-09-20 08:44:20 +03:00
8 lines
344 B
Scala
8 lines
344 B
Scala
use std, functional
|
|
|
|
data = ["apple", "banana", "cherry", "apricot", "coconut"]
|
|
println tomap(data, def(str) = str.substring(0, 1))
|
|
println tomap(data, def(str) = str.substring(0, 1), ::toUpperCase)
|
|
println tomap(data, def(str) = str.substring(0, 1), ::toUpperCase, ::joinValues)
|
|
|
|
def joinValues(oldValue, newValue) = oldValue + ", " + newValue |