KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I have an array of functions and I'm trying to produce one function which consists of the composition of the elements in my array. My approach is: def compose(list): if len(list) == 1: return lambda x:list[0](x) list.reverse() final=lambda x:x for f in list: final=lambda x:f(final(x)) return final This method doesn't seems to be working, help will be appreciated. (I'm reversing the list because this is the order of composition I want the functions to be)
Tags (comma-separated)
Save Edits
Cancel