Hacker News new | past | comments | ask | show | jobs | submit login

How much they've made so far, with scala:

  scala> def income(n_users:Int) = (1 to n_users) map(i => (i-1)*.001) reduceLeft(_+_)
 income: (Int)Double

  scala> income(2901)
 res0: Double = 4206.45



You need to round the intermediate values down like they seem to be doing.




Consider applying for YC's Spring batch! Applications are open till Feb 11.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: