6 kyu
Function Composition
2,516 of 13,852user578387
Description:
Function composition is a mathematical operation that mainly presents itself in lambda calculus and computability. It is explained well here, but this is my explanation, in simple mathematical notation:
f3 = compose( f1 f2 )
Is equivalent to...
f3(a) = f1( f2( a ) )
Your task is to create a compose
function to carry out this task, which will be passed two functions or lambdas. Ruby functions will be passed, and should return, either a proc or a lambda. Remember that the resulting composed function may be passed multiple arguments!
compose(f , g)(x)
=> f( g( x ) )
This kata is not available in haskell; that would be too easy!
Functional Programming
Fundamentals
Similar Kata:
Stats:
Created | Sep 23, 2014 |
Published | Sep 25, 2014 |
Warriors Trained | 26510 |
Total Skips | 5675 |
Total Code Submissions | 73758 |
Total Times Completed | 13852 |
Clojure Completions | 567 |
Ruby Completions | 595 |
Python Completions | 2516 |
JavaScript Completions | 10455 |
CoffeeScript Completions | 155 |
λ Calculus Completions | 86 |
Total Stars | 308 |
% of votes with a positive feedback rating | 86% of 861 |
Total "Very Satisfied" Votes | 667 |
Total "Somewhat Satisfied" Votes | 152 |
Total "Not Satisfied" Votes | 42 |