rusi writes: > Without resorting to lambdas/new-functions: > With functools.partial one can freeze any subset of a > function(callable's) parameters. > > In Haskell one can only freeze the first parameter or at most with > a right section the second
You have an f of type A -> B -> C -> D -> E in Haskell, you can freeze the first three parameters by calling it with three arguments. These are equivalent: f a b c d (f a b c) d (f a b) c d (f a) b c d So it's any initial sequence of arguments, not just the first. And I thought such types were preferred over A * B * C * D -> E in Haskell, so you tend to get this for free. Not sure of the syntax here - it's been long since I did anything at all with Haskell. A difference seems to be that in Python, a call can refer to named parameters. This gives functools.partial some power over Haskell. Another difference is that the value of functools.partial is always a function that needs to be called with the remaining arguments, even if there are none. Both the creation and the evaluation of the curried functions just happens in Haskell. (I also think that the word "currying" used to refer to what Haskell does and it's an extension to use it to mean any partial evaluation.) -- https://mail.python.org/mailman/listinfo/python-list