Difference between revisions of "Sum Distances To Origin Using Higher Order Functions Assignment"

From CSE425S Wiki
Jump to navigation Jump to search
Line 7: Line 7:
 
=Library Functions to Use=
 
=Library Functions to Use=
  
Note: you should only require one of the higher-order functions listed below:
 
  
 
==[https://smlfamily.github.io/Basis/list.html List]==
 
==[https://smlfamily.github.io/Basis/list.html List]==
 +
Note: you should only require one of the higher-order functions listed below:
 
* [https://smlfamily.github.io/Basis/list.html#SIG:LIST.map:VAL map] NOTE: curried
 
* [https://smlfamily.github.io/Basis/list.html#SIG:LIST.map:VAL map] NOTE: curried
 
* [https://smlfamily.github.io/Basis/list.html#SIG:LIST.map:VAL filter] NOTE: curried
 
* [https://smlfamily.github.io/Basis/list.html#SIG:LIST.map:VAL filter] NOTE: curried
 
* [https://smlfamily.github.io/Basis/list.html#SIG:LIST.foldl:VAL foldl] or [https://smlfamily.github.io/Basis/list.html#SIG:LIST.foldr:VAL foldr] NOTE: both curried
 
* [https://smlfamily.github.io/Basis/list.html#SIG:LIST.foldl:VAL foldl] or [https://smlfamily.github.io/Basis/list.html#SIG:LIST.foldr:VAL foldr] NOTE: both curried
 
* [https://smlfamily.github.io/Basis/list.html#SIG:LIST.map:VAL find] NOTE: curried
 
* [https://smlfamily.github.io/Basis/list.html#SIG:LIST.map:VAL find] NOTE: curried
 +
 +
==Math==
  
 
=Code To Implement=
 
=Code To Implement=

Revision as of 20:41, 26 September 2022

Motivation

Gain experience using higher-order functions.

Previous Warmup

This warmup is a variation of the Sum Distances To Origin with Functions warmup.

Library Functions to Use

List

Note: you should only require one of the higher-order functions listed below:

Math

Code To Implement

file: src/main/sml/warmup_sum_distances_to_origin_using_hof/sum_distances_to_origin.sml Smlnj-logo.png
functions: sum_distances_to_origin

Math.sqrt(v)

fun sum_distances_to_origin(xys : (real * real) list)

Test

source folder: src/test/sml/warmup_sum_distances_to_origin_using_hof
how to run with CM.make verbosity off: sml -Ccm.verbose=false run_sum_distances_to_origin_using_hof_testing.sml
how to run with CM.make verbosity on: sml run_sum_distances_to_origin_using_hof_testing.sml

note: ensure that you have removed all printing to receive credit for any assignment.

SML Error Messages