Why do these two statements give different outputs

#1

Why do these below statements give different output. I believe there is something wrong in the second statement,

(1 to 100).toList.filter(e => e%2 == 0).map(e => e*e).reduce((t, e) => t + e)
gives 171700

(1 to 100).toList.filter(e => e%2 == 0).reduce((t, e) => t + e*e)
gives 171698

0 Likes