
Dec. 2, 2021
9:42 a.m.
Abdulla Al Kathiri writes:
Thanks for the clarification. Yeah I agree it will look ugly if we use it not as a first argument many times in a row but what if there is one or two functions in the middle that they are not playing along and don’t have teamwork ethics,
Function definitions or lambdas are cheap.
1 -> add(2) -> pow(3, _) equivalent to 1 -> add(_, 2) -> pow(3, _). _ is where your output goes into. _ as a first argument can be omitted.
def rpow(x, y): return pow(y, x) 1 -> add(2) -> rpow(3) But in many cases it won't be necessary because you will be defining functions for the pipeline, rather than fitting the pipeline to preexisting functions.