Question: namespace Homework 3 open System.Reflection.Metadata open System.Runtime.Intrinsics.Arm module HW 3 = type SET = | I of int list / / I [ 1 ;
namespace Homework
open System.Reflection.Metadata
open System.Runtime.Intrinsics.Arm
module HW
type SET
I of int list I ;;
S of string list S a;b;c
IS of int string list IS a;b
II of int int list II ; ;
SS of string string list SS ab; cd
SI of string int list SI a; b; c
SISI of string intstring int list SISI ab; cd
SIIS of string intint string list SIIS ab; cd
complete this function
let pairs L L
complete this function
let dist a L
cartesian product
let product s s
match s s with
I s I s II pairs s s you need to write pairs
S s S s SS pairs s s
I s S s IS pairs s s
you need to complete these cases
The following four methods are incorrect and must be replaced!
let gtSx x y true
to do
let eqxIxx x y true
ot do
let selectSI x y I
to do
let selectSIIS x y I
to do
let rec isMember a L
match L with
false
h::t when ah true
h::t isMember a t
let rec unionList l l
match l with
l
h::t when not isMember h l h::unionList t l
h::t unionList t l
let union s s
match s s with
I l I l I unionList l l
IS l IS l IS unionList l l
SISI l SISI l SISI unionList l l
you need to complete these cases
to do
let gtIx x a a x
let gtxxxI x a a x
let gtSx
to do
let eqIxx
to do
let rec filter f L
match L with
h::t when f h h::filter f t
h::t filter f t
let selectIS s f
match s with
IS i IS filter f i
let selectSISI s f
match s with
SISI i SISI filter f i
let minus L L
to do
let difference s s
match ss with
I s I s I minus s s write the minus function
SI s SI s SI minus s s
SISI s SISI s SISI minus s s
complete these cases
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
