Live data from Hacker News

I Finally Understand Closures

iode.co.uk

21–22 of 22 posts

Re: I Finally Understand Closures

#21
post #2

Why are there so many of these "I finally understand [cloures | pointers | misc CS concept]" posts? I mean these are pretty fundamental concepts that any first year CS student should be able to grasp pretty quickly.

Because many of us never were CS undergrads. We formally learnt to program in the context of another field (Mech Eng in my case - FORTRAN, MATLAB and DCL), and prior to that were entirely self-taught. Many of us have many years of experience with procedural and object-oriented styles and are only recently coming to the functional style, either out of pure interest, or out of necessity. So bear with us :-)

Re: I Finally Understand Closures

#22
post #9

Maybe now he also understands why objects are often preferable. Closures are liked handicapped objects. Names are resolved when the closures is created, not when it is called. This is not nearly as flexible as an object, where names are resolved when the function is called.

OK, have fun implementing an interface just to manipulate a collection when a one-liner would have sufficed.

Why do you assume you can't use a one liner in an OO language?

Counter example:

list(1, 2, 3, 4) map(+(1))

http://iolanguage.com/

Post reply on HN