+ 2
How do I get run this composition[solved]
It works ... but not for reduce https://code.sololearn.com/ca8a25a157A2
11 Respuestas
+ 3
this link may help you to understand how to use reduce() for compositing:
https://mathieularose.com/function-composition-in-JUMP_LINK__&&__python__&&__JUMP_LINK
+ 2
visph thats actually what I wanted.
But why does my way not work?
I reduce a value with a function and get a value again. Val,func
The link does the same with func,func
+ 2
actually you pass to callme() two functions, while it expect one arg and one function: you are skipping the compose() function step of the link (wich takes two functions as arguments) and you should add callme calls somewhere else ^^
+ 2
Yeah....I added the initializer now it works
+ 2
:D
I was trying that first of all, but got error saying that reduce doesn't expect 'initializer' argument ^^
+ 2
sorry I don't understand your last reply?
In mine, I was implicitly saying 'named' argument... but finally you successed by passing initializer as unnamed argument, wich I have not tried ;P
+ 1
Yeah forgot to save
+ 1
I forgot to save the working version.
+ 1
Oh I see now... no need of your old callme function ^^
+ 1
Oh...tell me how?
+ 1
I mean the one wich was expecting arg and function as argument ^^
now your actual callme function is like the compose2 one returned by compose function in the link I had first provided ;P