Question: F#: Exercise 2.3 Write a function combinePair : int list -> (int*int) list so that combinePair xs returns the list with elements from xs combined
F#: Exercise 2.3 Write a function combinePair : int list -> (int*int) list so that combinePair xs returns the list with elements from xs combined into pairs. If xs contains an odd number of elements, then the last element is thrown away: combinePair [x1; x2; x3; x4] = [(x1,x2);(x3,x4)] combinePair [x1; x2; x3] = [(x1,x2)] combinePair [] = [] combinePair [x1] = [].
Hint: use pattern matching
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
