Hw3 provided sml file

Home - Hw3 provided sml file - Hw3 provided sml file

26.08.2019-533 views -Hw3 provided sml file

 Hw3 provided sml document Essay

(* Homework3 Simple Test*)

(* These are basic test instances. Passing these tests would not guarantee that your code will certainly pass some of the homework grader *) (* To run the test, add a fresh line towards the top with this file: work with " homeworkname. sml"; *) (* Each of the tests ought to evaluate to true. For example , the REPL should state: val test1 = true: bool *)

val test2 = only_capitals [" A", " B", " C" ] sama dengan [" A", " B", " C" ]

val test2 = longest_string1 [" A", " bc", " C" ] = " bc"

alternativ test3 sama dengan longest_string2 [" A", " bc", " C" ] = " bc"

alternativ test4a= longest_string3 [" A", " bc", " C" ] = " bc"

val test4b= longest_string4 [" A", " B", " C" ] = " C"

alternativ test5 = longest_capitalized [" A", " bc", " C" ] = " A";

alternativ test6 sama dengan rev_string " abc" sama dengan " cba";

val test7 = first_answer (fn times => in the event that x > 3 then SOME x different NONE ) [1, 2, 3, 4, 5] sama dengan 4

alternativ test8 sama dengan all_answers (fn x => if back button = one particular then SOME [x] else non-e ) [2, 3, 4, your five, 6, 7] = NONE

val test9a = count_wildcards Wildcard = one particular

val test9b = count_wild_and_variable_lengths (Variable(" a" )) sama dengan 1

val test9c sama dengan count_some_var (" x", Variable(" x" )) = you;

val test10 = check_pat (Variable(" x" )) = true

val test11 = match (Const(1), UnitP) sama dengan NONE

(* Homework3 Straightforward Test*)

(* These are standard test circumstances. Passing these kinds of tests will not guarantee that the code can pass you see, the homework grader *) (* To run the test, add a fresh line to the top of the file: work with " homeworkname. sml"; *) (* All of the tests will need to evaluate to true. For example , the REPL should say: val test1 = authentic: bool *)

val test1 = only_capitals [" A", " B", " C" ] sama dengan [" A", " B", " C" ]

val test2 = longest_string1 [" A", " bc", " C" ] = " bc"

alternativ test3 = longest_string2 [" A", " bc", " C" ] = " bc"

alternativ test4a= longest_string3 [" A", " bc", " C" ] = " bc"

val test4b= longest_string4 [" A", " B", " C" ] = " C"

alternativ test5 sama dengan longest_capitalized [" A", " bc", " C" ] = " A";

alternativ test6 = rev_string " abc" = " cba";

val test7 = first_answer (fn times => in the event that x > 3 then SOME x more non-e ) [1, 2, three or more, 4, 5] = 4

val test8 = all_answers (fn x => if by = you then...

Related