Difference between revisions of "Closest To Origin Assignment"
Jump to navigation
Jump to search
| Line 1: | Line 1: | ||
| + | =Background= | ||
| + | <math>\sqrt {x^2 + y^2}</math> | ||
| + | |||
=Basis Library= | =Basis Library= | ||
==[https://smlfamily.github.io/Basis/option.html Option]== | ==[https://smlfamily.github.io/Basis/option.html Option]== | ||
Revision as of 19:57, 7 September 2022
Background
Failed to parse (MathML with SVG or PNG fallback (recommended for modern browsers and accessibility tools): Invalid response ("Math extension cannot connect to Restbase.") from server "https://wikimedia.org/api/rest_v1/":): {\displaystyle \sqrt {x^2 + y^2}}
Basis Library
Option
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 : (real*real) list) : (real*real) 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.