7 kyu
Chain me
4,483 of 7,370nrgarg
Description:
Write a generic function chainer
Write a generic function chainer that takes a starting value, and an array of functions to execute on it (array of symbols for Ruby).
The input for each function is the output of the previous function (except the first function, which takes the starting value as its input). Return the final value after execution is complete.
function add(num) {
return num + 1;
}
function mult(num) {
return num * 30;
}
chain(2, [add, mult]);
// returns 90;
Fundamentals
Similar Kata:
Stats:
Created | Mar 7, 2015 |
Published | Mar 7, 2015 |
Warriors Trained | 15277 |
Total Skips | 1091 |
Total Code Submissions | 23269 |
Total Times Completed | 7370 |
JavaScript Completions | 4483 |
Ruby Completions | 654 |
C# Completions | 603 |
C Completions | 167 |
Haskell Completions | 93 |
Julia Completions | 23 |
Python Completions | 1481 |
Factor Completions | 14 |
OCaml Completions | 71 |
NASM Completions | 19 |
Prolog Completions | 13 |
Rust Completions | 113 |
Total Stars | 128 |
% of votes with a positive feedback rating | 92% of 782 |
Total "Very Satisfied" Votes | 681 |
Total "Somewhat Satisfied" Votes | 79 |
Total "Not Satisfied" Votes | 22 |