Question: We need to write 3 small functions on list operations both provided by the standard library and useful utility functions. Language to be used -

We need to write 3 small functions on list operations both provided by the standard library and useful utility functions.

Language to be used - F#

Urgent help, will give thumbs up and good feedback, thank you!

We need to write 3 small functions on list operations both provided

by the standard library and useful utility functions. Language to be used

- F# Urgent help, will give thumbs up and good feedback, thank

Exercise #17: isMatch str The isMatch function returns true if str has matching parentheses, and false otherwise. Parentheses are matched if the following conditions are true 1. The number of y's can not exceed the number of ( for any substring starting from the beginning 2. The number of ('s and )'s are equal at the end of the string You only need to check whether the left parentheses 'l' and the right parentheses ')' matches in str, and any other character in str is irrelevant to whether the parentheses match or not. A function stringToCharList is provided to translate the string into a char list to make it easier to parse/traverse with your algorithm. The is Match function should be written in the Project02-17.fs file. // // isMatch str // returns true if str has matching parentheses, and false otherwise // // Examples: // isMatch" => true isMatch "(" => false isMatch ")" => false isMatch "outer (middle({ true isMatch "outer (middle(inner})" => false // Exercise #18: firstMatch str The firstMatch function finds the FIRST pair of matching parentheses and returns the substring inside the parenthesis. The first pair is defined as the pair whose left parenthesis '(' appears first in the string, not whose right parenthesis ')' appears first. For example, when the input is input="krepe((choko) (kream))", the first left parenthesis is index[5] (counting from 0), and the matching right parenthesis is input[20], so the substring inside it is input[6..19]= ="(choko) (kream)". You can assume (isMatch str = true). A function stringToCharlist is provided to translate the string into a char list, in addition to a function charListToString to convert the resulting list you build back into a string. The firstMatch function should be written in the Project02-18.fs file. // // firstMatchs // returns a string containing the content within the first pair of matching parentheses // first means started first with a '('not ended first with a ')' // Examples: firstMatch firstMatch "()" => "" firstMatch "phrase (comment)" => "comment" // firstMatch "phrase (comment) Furthermore (details)" => "comment" // firstMatch "krepe((choko) (kream))" => "(choko) (kream)"// Exercise #19: all Matches str The allMatch function returns a list of all substrings inside all the parentheses, in the order they appear. You can assume (isMatch str = true). You might find firstMatch helpful as a starting point for this algorithm. The all Matches function should be written in the Project02-19.fs file. // // allMatches s // returns the content in the first pair of matching parentheses // // Examples: // allMatches". => [] // allMatches "()" => [""] // allMatches "phrase (comment)" => ["comment"] // allMatches "phrase (comment) Furthermore (details)" => ["comment"; "details"] // allMatches "krepe((choko(kream)))"=> // ["(choko(kream))"; "choko(kream)"; "kream"] allMatches "krepe((choko() (kream)))"=> ["(choko() (kream))"; "choko( ) (kream)"; ""; "kream" ] //

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!