Created
January 8, 2015 17:13
-
-
Save ssaunier/16fba9f80408fe46a0d2 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def sum_odd_indexed(array) | |
# TODO: computes the sum of elements at odd indices (1, 3, 5, 7, etc.) | |
# You should make use Enumerable#each_with_index | |
end | |
def even_numbers(array) | |
# TODO: Return the even numbers from a list of integers. | |
# You should use Enumerable#select | |
end | |
def short_words(array, max_length) | |
# TODO: Take and array of words, return the array of words not exceeding max_length characters | |
# You should use Enumerable#reject | |
end | |
def first_under(array, limit) | |
# TODO: Return the first number from an array that is less than limit. | |
# You should use Enumerable#find | |
end | |
def add_bang(array) | |
# TODO: Take an array of strings and return a new array with "!" appended to each string. | |
# You should use Enumerable#map | |
end | |
def concatenate(array) | |
# TODO: Concatenate all strings given in the array. | |
# You should use of Enumerable#reduce | |
end | |
def sorted_pairs(array) | |
# TODO: Reorganize an array into slices of 2 elements, and sort each slice alphabetically. | |
# You should make use of Enumerable#each_slice | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment