Difference between revisions of "Closest To Origin Assignment"
Jump to navigation
Jump to search
Line 8: | Line 8: | ||
fun closest_to_origin(xys : (int*int) list) : (int*int) option | fun closest_to_origin(xys : (int*int) list) : (int*int) option | ||
− | which | + | which returns closest point to the origin, if it exists. |
=Test= | =Test= | ||
{{SMLUnitTesting|closest_to_origin|closest_to_origin}} | {{SMLUnitTesting|closest_to_origin|closest_to_origin}} |
Revision as of 05:02, 7 September 2022
Code to Implement
file: | src/main/sml/closest_to_origin/closest_to_origin.sml | |
functions: | closest_to_origin |
closest_to_origin
Write a function
fun closest_to_origin(xys : (int*int) list) : (int*int) option
which returns closest point to the origin, if it exists.
Test
source folder: | src/test/sml/closest_to_origin |
how to run with CM.make verbosity off: | sml -Ccm.verbose=false closest_to_origin.sml |
how to run with CM.make verbosity on: | sml closest_to_origin.sml |
note: ensure that you have removed all printing to receive credit for any assignment.