54. Pairwise algorithm

Write a general-purpose function that, given a range, returns a new range with pairs of consecutive elements from the input range. Should the input range have an odd number of elements, the last one must be ignored. For example, if the input range was {1, 1, 3, 5, 8, 13, 21}, the result must be { {1, 1}, {3, 5}, {8, 13}}.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset