def main
(args
: Array
[String
]){ val lives
= List
(Life
(10), Life
(20), Life
(30)) def livesMean
(l
:List
[Life
]):Double
= { val avg
= lives.
map(_.
age).
sum/lives.
size
avg
}
println("average of lives "+ livesMean(lives))
}
}
c2VhbGVkIGFic3RyYWN0IGNsYXNzIENvbXBvbmVudApjYXNlIGNsYXNzIExpZmUgKGFnZTpJbnQpIGV4dGVuZHMgQ29tcG9uZW50CgpvYmplY3QgTWFpbiBleHRlbmRzIENvbXBvbmVudHsKCWRlZiBtYWluKGFyZ3M6IEFycmF5W1N0cmluZ10pewogICAgdmFsIGxpdmVzID0gTGlzdChMaWZlKDEwKSwgTGlmZSgyMCksIExpZmUoMzApKQogICAgZGVmIGxpdmVzTWVhbiAobDpMaXN0W0xpZmVdKTpEb3VibGUgPSB7CiAgICAgICAgdmFsIGF2ZyA9IGxpdmVzLm1hcChfLmFnZSkuc3VtL2xpdmVzLnNpemUKICAgICAgIAogICAgICAgIGF2ZwogICAgfQogICAgcHJpbnRsbigiYXZlcmFnZSBvZiBsaXZlcyAiKyBsaXZlc01lYW4obGl2ZXMpKQogIH0KICAKICAKfQ==