|
|
|
|
|
by eru
3785 days ago
|
|
Yes, even pure functions are not introspectable. All you can really do with a function is call it on a value and get a return value. (For the sake of simplicity, I am ignoring side effects here.) Let me try to rephrase with an example. Eg you might have an API for a file that allows you to open a file, manipulate it, and then close it. That's a very procedural interface. As an alternative, think of an interface like the following: withOpenFile(filename, manipulator)
that opens a the file, calls the manipulator function on the contents, and automatically closes it.Or compare map, filter and reduce vs manually iterating over a collection of items. I did really like your grandfather comment (https://news.ycombinator.com/item?id=11099224). I hope I've cleared up my point? |
|