Question: Please use F# language. Can someone help me with these two exercise. Exercise 2.3 Write a function combinePair int list-(int int) list so that combinePair

Please use F# language. Can someone help me with these two exercise. Please use F# language. Can someone help me with these two exercise.

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 [xl x2; x3; x4] -(x1, x2); (x3, x4)1 combinePair [x1; x2; x3] = [(x1,x2)] combinePair [] = [] combinePair [x1] = [] Hint: Try use pattern matching. Exercise 2.4 Write a function explode string ->char list so that explode s returns the list of characters in s explode "star" = [ , s' ; , t, ; , a, ; , r' ] Hint: if s is a string then s.ToCharArray ( returns an array of characters. You can then use List.ofArray Now write a function explode2 string -> char list to turn it into a list of characters. similar to explode except that you now have to use the string function s . chars (orLD, where s is a string. You can also make use of s.Remove (0,1).The definition of explode2 will be recursive. 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 [xl x2; x3; x4] -(x1, x2); (x3, x4)1 combinePair [x1; x2; x3] = [(x1,x2)] combinePair [] = [] combinePair [x1] = [] Hint: Try use pattern matching. Exercise 2.4 Write a function explode string ->char list so that explode s returns the list of characters in s explode "star" = [ , s' ; , t, ; , a, ; , r' ] Hint: if s is a string then s.ToCharArray ( returns an array of characters. You can then use List.ofArray Now write a function explode2 string -> char list to turn it into a list of characters. similar to explode except that you now have to use the string function s . chars (orLD, where s is a string. You can also make use of s.Remove (0,1).The definition of explode2 will be recursive

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!