Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Provide expressions ( without type annotations ) that have the following types ( a > int ) > a > int ( f ) (
Provide expressions without type annotations that have the following types
a int a int
f pointa a b list b list
g point Define a function f that when used in the following expression will not produce
any type errors:
f o l d l e f t f ; ; ; ;
The implementation and type of foldle are given for reference, below.
l e t r e c f o l d l e f t f a l match l with
a
h : : t f o l d l e f t f f a h t
h point What would you put in place for the blank such that the following code returns
l e t f fun x y z
L i s t f o l d l e f t fun a c c e a c c e y z x in
f ; ; ;
hat would you put in place for the blank such that sublist and
sublist ; ; ; ;
l e t s u b l i s t l t
f o l d r i g h t fun x a l
The implementation of foldright is given for reference, below.
l e t r e c f o l d r i g h t f l a c c match l with
a c c
x : : x s f x f o l d r i g h t f x s a c c
j point What would you put in place for the blank such that the following program
returns
type t a x p a y e r
P e r s o n of f l o a t
Company of f l o a t
l e t t a x y
l e t i n c o m e t a x a x in
match y with
P e r s o n i i n c o m e t a x i
Company j i n c o m e t a x j in
t a x P e r s o n t a x Company
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started