-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathhw2providedTests.sml
31 lines (22 loc) · 1013 Bytes
/
hw2providedTests.sml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
use "hw2provided.sml";
(* 1.a *)
all_except_option( "x", ["x","y","z"]) = SOME(rev(["y","z"]));
(* 1.b *)
get_substitutions1([["Fred","Fredrick"],["Elizabeth","Betty"],["Freddie","Fred","F"]],"Fred")
= rev ["Fredrick","Freddie","F"]; (* Should be true *)
(* 1.c *)
get_substitutions2([["Fred","Fredrick"],["Jeff","Jeffrey"],["Geoff","Jeff","Jeffrey"]],"Jeff")
= ["Jeffrey","Geoff","Jeffrey"]; (* Should be true *)
get_substitutions2([["Fred","Fredrick"],["Jeff","Jeffrey"],["Geoff","Jeff","Jeffrey"]],"Harry")
= []; (* Should be true *)
(* 1.d *)
similar_names([["Fred","Fredrick"],["Elizabeth","Betty"],["Freddie","Fred","F"]],{first="Fred", middle="W", last="Smith"}) =
[{first="Fred", last="Smith", middle="W"},
{first="Fredrick", last="Smith", middle="W"},
{first="Freddie", last="Smith", middle="W"},
{first="F", last="Smith", middle="W"}] ; (* Should be true *)
(* 2.a *)
card_color(Spades,Ace) = Black;
card_color(Clubs,Ace) = Black;
card_color(Diamonds,Ace) = Red;
card_color(Hearts,Ace) = Red;