October 2014
Intermediate to advanced
280 pages
7h 20m
English
Write a mapsum function that takes a list and a function. It applies the function to each element of the list and then sums the result, so
| | iex> MyList.mapsum [1, 2, 3], &(&1 * &1) |
| | 14 |
Write a max(list) that returns the element with the maximum value in the list. (This is slightly trickier than it sounds.)
An Elixir single-quoted string is actually a list of individual character codes. Write a caesar(list, n) function that adds n to each list element, wrapping if the addition results in a character greater than z.
| | iex> MyList.caesar('ryvkve', 13) |
| | ?????? :) |
Read now
Unlock full access