Question: Lists and Recursion 4.4. (*>* Task 4.4 *>*) let parens (l: char list) : bool = raise ImplementMe ;; One important syntactic task of programming

Lists and Recursion

4.4.

Lists and Recursion 4.4. (*>* Task 4.4 *>*) let parens (l: char

(*>* Task 4.4 *>*)

let parens (l: char list) : bool = raise ImplementMe ;;

One important syntactic task of programming in most languages is making sure your parentheses match! Write a function parens that takes a list of characters including open parens' and close parens')'. It should return true if and only if all parentheses are correctly matched. Hints/additional specifications: You will probably want a recursive helper function that scans the list left to right and tracks some additional information. . If you reach the end of the list and there are unmatched open parens, the parens are not matched. If you see a close paren that doesn't match an open paren, the parens are not matched. A list with no parentheses is considered correctly matched. You can ignore any characters other than '(' and ')

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!