Difference between revisions of "Sum Scan No Identity Element Assignment"
Jump to navigation
Jump to search
Line 1: | Line 1: | ||
Reimplement [[Sum_Scan_Assignment|Sum Scan]] with no identity element. | Reimplement [[Sum_Scan_Assignment|Sum Scan]] with no identity element. | ||
+ | =Background= | ||
+ | A clean solution to sum_scan can be achieved by leveraging sum's [https://en.wikipedia.org/wiki/Identity_element Identity element] of 0. The coming [[Scan_Higher_Order_Function_Assignment|scan higher order function exercise]] must make do without this information. Since we often only use the identity element (if we use it at all) to apply with the value of first item in a list to get that value of the first item in the list back again, this should not be the greatest inconvenience. | ||
=Code to Implement= | =Code to Implement= |
Latest revision as of 05:15, 21 January 2023
Reimplement Sum Scan with no identity element.
Background
A clean solution to sum_scan can be achieved by leveraging sum's Identity element of 0. The coming scan higher order function exercise must make do without this information. Since we often only use the identity element (if we use it at all) to apply with the value of first item in a list to get that value of the first item in the list back again, this should not be the greatest inconvenience.
Code to Implement
file: | src/main/sml/warmup_sum_scan_no_identity_element/sum_scan_pattern.sml | |
functions: | sum_scan |
Test
source folder: | src/test/sml/warmup_sum_scan_no_identity_element |
how to run with CM.make verbosity off: | sml -Ccm.verbose=false run_sum_scan_no_identity_element.sml |
how to run with CM.make verbosity on: | sml run_sum_scan_no_identity_element.sml |
note: ensure that you have removed all printing to receive credit for any assignment.