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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!