Great Deal! Get Instant $10 FREE in Account on First Order + 10% Cashback on Every Order Order Now

texpr Note: • if an empty list is encountered, raise (Failure "empty list") • if a list has inconsistent types, raise (Failure "inconsistent") • list order is preserved negExample from Problem 5...

1 answer below »
Problem 6
Note that we can actually infer the type of an texpr. If we see (x, IntLit (8)),we know x should be
an Int. So now write a similar function infer which overwrites any incorrect types.
val infer: texpr -> texpr
Note:
• if an empty list is encountered, raise (Failure
Extracted text: Problem 6 Note that we can actually infer the type of an texpr. If we see (x, IntLit (8)),we know x should be an Int. So now write a similar function infer which overwrites any incorrect types. val infer: texpr -> texpr Note: • if an empty list is encountered, raise (Failure "empty list") • if a list has inconsistent types, raise (Failure "inconsistent") • list order is preserved negExample from Problem 5 should be inconsistent. let infExample = (List Int, Seq [ (Int, Seq [(Bool, BoolLit false); (Bool, Boollit true)]); (Bool, Seq [(Int, Boollit true)]) ]) in infer infExample evaluates to (List (List Bool), Seq [ (List Bool, Seq [(Bool, Boollit false); (Bool, Boollit true)]); (List Bool, Seq [(Bool, Boollit true)]) ])
Answered 120 days After Jun 08, 2022

Solution

Aditi answered on Oct 06 2022
66 Votes
SOLUTION.PDF

Answer To This Question Is Available To Download

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here