Paul Moore wrote: > I like curry(). The others don't bring the right concept to mind for me. > I apologise if this offends the purists, but *all* of the recent attempts > to "clarify" the difference between partial application and currying have > simply confused me. Partial application is specifying some of the arguments of a function, so you get a new function that takes fewer arguments. Currying is making a function take one argument at a time, doing partial application as it goes. Highbrow but enlightening example: Suppose F is a function that takes a programming language spec and a program in that language, and executes the program. (You could call it a "generic interpreter".) Then - Partial application turns F into a specialized interpreter, such as a Python interpreter. The partially applied function takes fewer parameters, because some have been fixed. - Currying turns F into an interpreter generator. You feed it a language spec and it spits out an interpreter. The curried function takes the same number of parameters, but you give it them in a different way. "Curry plus call equals partial-apply." > If curry() gets screams of outrage, someone suggested bind() to follow the > Boost C++ library's usage. That's tolerable, although I find it too generic > a word. I think I like that better than the other proposals currently on the table. * By the way, "purists" are more likely to be offended by being caricatured ("purists", "screams of outrage") than by the fact that someone has difficulty understanding what they say. But it's no big deal. -- g
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4