Beta

Compose Two Lambdas!

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

Stats:

CreatedApr 8, 2020
PublishedApr 8, 2020
Warriors Trained516
Total Skips262
Total Code Submissions165
Total Times Completed35
Python Completions35
Total Stars4
% of votes with a positive feedback rating71% of 19
Total "Very Satisfied" Votes13
Total "Somewhat Satisfied" Votes1
Total "Not Satisfied" Votes5
Total Rank Assessments18
Average Assessed Rank
5 kyu
Highest Assessed Rank
2 kyu
Lowest Assessed Rank
7 kyu
Ad
Contributors
  • Dr Gabo Avatar
  • FArekkusu Avatar
Ad