Difference between revisions of "Closest To Origin Assignment"

From CSE425S Wiki
Jump to navigation Jump to search
(Created page with "=Code to Implement= {{SMLToImplement|closest_to_origin|closest_to_origin|warmup_closest_to_origin}} ==is_strictly_ascending== Write a function fun closest_to_origin(xys :...")
 
Line 3: Line 3:
 
{{SMLToImplement|closest_to_origin|closest_to_origin|warmup_closest_to_origin}}
 
{{SMLToImplement|closest_to_origin|closest_to_origin|warmup_closest_to_origin}}
  
==is_strictly_ascending==
+
==closest_to_origin==
 
Write a function
 
Write a function
  

Revision as of 05:24, 14 February 2022

Code to Implement

file: src/main/sml/warmup_closest_to_origin/closest_to_origin.sml Smlnj-logo.png
functions: closest_to_origin

closest_to_origin

Write a function

fun closest_to_origin(xys : (int*int) list) : (int*int) option

which optionally returns closest point to the origin, if it exists.

Test

file: unit_test_closest_to_origin.sml
source folder: src/test/sml/warmup_closest_to_origin