Beta
Compose Two Lambdas!
35Dr Gabo
Description:
Your task
Write a function that takes two functions and composes them like this:
a = lambda a0, a1, ..., an: ...
b = lambda b0, b1, ..., bm: ...
compose(a, b) == lambda b0, b1, ..., bm, a1, ..., an: a(b(b0, b1, ..., bm), a1, ..., an)
Important note: the number of positional arguments will be checked (it has to be exact!).
Test data
The functions in the tests will have between 1
and 50
arguments, just enough so you won't hardcode solutions.
Example
a = lambda i, j: i * j
b = lambda i, j: i + j
compose(a, b) == lambda i, j, k: a(b(i, j), k) # i.e. => lambda i, j, k: (i + j) * k
Have fun :D
Functional Programming
Metaprogramming
Fundamentals
Similar Kata:
Stats:
Created | Apr 8, 2020 |
Published | Apr 8, 2020 |
Warriors Trained | 516 |
Total Skips | 262 |
Total Code Submissions | 165 |
Total Times Completed | 35 |
Python Completions | 35 |
Total Stars | 4 |
% of votes with a positive feedback rating | 71% of 19 |
Total "Very Satisfied" Votes | 13 |
Total "Somewhat Satisfied" Votes | 1 |
Total "Not Satisfied" Votes | 5 |
Total Rank Assessments | 18 |
Average Assessed Rank | 5 kyu |
Highest Assessed Rank | 2 kyu |
Lowest Assessed Rank | 7 kyu |