Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions