On Mon, 2010-02-01 at 20:37 +0100, Hans Meine wrote: > > >>> square = kaa.Callable(pow, 2) > > >>> print square(5) > > In fact, this looks more like currying than like a partial function to me. ;-) > > (I.e. pow is curried, in the sense that arguments are 'attached'/'filled in'.) > > Although square will be a partial function in the sense that it cannot be > called with arbitrarily typed objects, this is obviously not what is meant > here.
I think currying is commonly mistaken for partial applications. I'd also not properly understood the difference. It's possible I still don't, mind you. Currying is a functional construct, so I refer to [1] which defines currying as: Currying is the process of transforming a function that takes multiple arguments into a function that takes just a single argument and returns another function if any arguments are still needed. And according to [2] the partial application is: Partial application in Haskell involves passing less than the full number of arguments to a function that takes multiple arguments. I also like the definitions given in [3]. But basically currying of pow() would look like this: >>> curry(pow)(2)(5) 32 Whereas the square() example in the docs is an example of a partial application. > However, I would have inserted 'even' into "They can [even] be used to > construct...", or is this the only point of Callable objects? Agreed, "even" is good suggestion. For kaa.Callable, it's really only directly useful for partial applications, because otherwise you could pass the underlying callable instead. But kaa.WeakCallable is useful in the case of methods, even ignoring arguments. Cheers, Jason. [1] http://www.haskell.org/haskellwiki/Currying [2] http://www.haskell.org/haskellwiki/Partial_application [3] http://www.kirit.com/Blog:/2007-09-10/What%20do%20you%20get%20when%20you%20curry%20partial%20application%3F ------------------------------------------------------------------------------ The Planet: dedicated and managed hosting, cloud storage, colocation Stay online with enterprise data centers and the best network in the business Choose flexible plans and management services without long-term contracts Personal 24x7 support from experience hosting pros just a phone call away. http://p.sf.net/sfu/theplanet-com _______________________________________________ Freevo-devel mailing list Freevo-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/freevo-devel