6 kyu
Infinite Sequences
80 of 202Mackay
Description:
Write a method which defines an infinite sequence for a given rule, and allows use of the #take
and #take_while
methods (JS: take
and takeWhile
property) to get 'n' elements of the sequence, or all elements that match a condition.
Example:
sequence {|n| n}.take_while {|n| n < 10} => [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
sequence {|n| (n * n)}.take(10) => [0, 1, 4, 9, 16, 25, 36, 49, 64, 81]
Fundamentals
Similar Kata:
Stats:
Created | Oct 17, 2014 |
Published | Oct 17, 2014 |
Warriors Trained | 558 |
Total Skips | 113 |
Total Code Submissions | 614 |
Total Times Completed | 202 |
Ruby Completions | 80 |
JavaScript Completions | 127 |
Total Stars | 22 |
% of votes with a positive feedback rating | 94% of 76 |
Total "Very Satisfied" Votes | 69 |
Total "Somewhat Satisfied" Votes | 5 |
Total "Not Satisfied" Votes | 2 |
Total Rank Assessments | 14 |
Average Assessed Rank | 5 kyu |
Highest Assessed Rank | 4 kyu |
Lowest Assessed Rank | 7 kyu |