Talk:Partial function application: Difference between revisions

Line 201:
f (a, b, x) = a * x + b
 
g :: Integer -> Integer -> Integer -> Integer -- idiomatic
g a b x = a * x + b
 
Line 209:
main = let u = curry3 f
v = papply2 (papply3 f 7) 9
w = g 7 9 -- non-idiomatic
in print [map (u 7 9) [1..5], map v [1..5], map w [1..5]]
</lang>
Line 219:
return lambda a: lambda b: lambda x: f(a, b, x)
 
def f(a, b, x): # idiomatic
return a * x + b
 
Line 228:
u = curry3(f)
v = partial(f, 7, 9)
w = g(7)(9) # idiomatic
print [map(u(7)(9), [1,2,3,4,5]), map(v, [1,2,3,4,5]), map(w, [1,2,3,4,5])]
</lang>
Anonymous user