so, if: ```val obj1 = MyDataObj(1,3,4) val obj2 = ...
# getting-started
d
so, if:
Copy code
val obj1 = MyDataObj(1,3,4)
val obj2 = MyDataObj(3,2,3)
val obj3 = MyDataObj(2,4,1)
val list = listof(obj1,obj2,obj3)
I would like to derive
objTot
, which has a=6, b=9, c=8
c
Or
reduce
to use the first object in the list as the starting accumulator, instead of manually specifying one. https://pl.kotl.in/JFktqNpTr
Semantically,
reduce
is for when you are “collapsing” values into a single object of the same type as the originals.
fold
is when you’re collapsing those values into a different type, or you want to manually specify the starting state for accumulation
d
great! thank you