Eliminate Unsorted Assignment
Revision as of 04:55, 5 September 2022 by Dennis.cosgrove (talk | contribs) (Created page with "=Code to Implement= {{SMLToImplement|eliminate_unsorted|eliminate_unsorted|warmup_eliminate_unsorted}} ==eliminate_unsorted== Write a function fun eliminate_unsorted(xs :...")
Contents
Code to Implement
file: | src/main/sml/warmup_eliminate_unsorted/eliminate_unsorted.sml | ![]() |
functions: | eliminate_unsorted |
eliminate_unsorted
Write a function
fun eliminate_unsorted(xs : int list) : int list
which produces a list of the already sorted items, eliminated any unsorted items.
Example [1, 6, 1, 8, 0, 3, 3, 9, 8, 8, 7]
For example:
eliminate_unsorted([1, 6, 1, 8, 0, 3, 3, 9, 8, 8, 7])
would produce:
[1, 6, 8, 9]
Example [131,231,425]
For example:
sum_scan([131,231,425])
would produce:
[131, 362, 787]
xs 131 231 425 sum_scan(xs) 131 362 787
Test
source folder: | src/test/sml/warmup_eliminate_unsorted |
how to run with CM.make verbosity off: | sml -Ccm.verbose=false run_eliminate_unsorted_testing.sml |
how to run with CM.make verbosity on: | sml run_eliminate_unsorted_testing.sml |
note: ensure that you have removed all printing to receive credit for any assignment.