Hacker Newsnew | past | comments | ask | show | jobs | submit | Viktoras25's commentslogin

Son: “Well. Hm. If the function is the (+), then you first apply that to the 1. So…..you have something like (1 +)? And now you apply that to the 2? And then you get the final answer?”

Seriously? He grabbed the idea just like this? Am I that old and stupid, that partial application didn't seem to me that easy? Or is currying what kids learn in a kindergarten these days? Sorry for my ranting, I'm just really amazed. A humanity went a long way to understanding such quite abstract conceptions as number 0 (as absence of something). And at 10 years kids, i think, are still learning by seeing, touching, playing. So concluding a much more abstract idea seems really fantastic.


Finally I found out the correct version: foldr (+) 0 [1,2,3]

1. + contains only special characters and must be used either as infix function (1 + 2) or be enclosed in brackets

2. You need an initial value for the accumulator. You are reducing a list to a single value, you need to start somewhere

Please, gurus of Haskell, correct me if I'm wrong, I've just recently started to learn the language


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

Search: