Question: This should be done in programming language : Standard ML or .sml http://sml-family.org/Basis/top-level-chapter.html http://sml-family.org/Basis/list.html http://sml-family.org/Basis/list-pair.html For some functions, polymorphic equality comparison is needed. I'm now
This should be done in programming language : Standard ML or .sml

http://sml-family.org/Basis/top-level-chapter.html http://sml-family.org/Basis/list.html http://sml-family.org/Basis/list-pair.html For some functions, polymorphic equality comparison is needed. I'm now explicitly showing this in the type of the function 1. (i) Code in SML a function segs3 'a list - ('a list) list that returns the list of all length-3 segments (sequences of 3 consecutive elements) of the given list. (A list of length 2 or less has no such segments.) ,7,9,10,5,12,18]; - segs3 [3, val it -[[3,7,9],[7,9,10], [9,10,5], [10,5,12], [5,12,18]] : (int list) list (ii) Code a function avgs3 real list -real list that returns the average of all length-3 segments of the given list of reals. (Use segs3.) - avgs3 [3.0,7.0,9.0,10.0,5.0,12.0,18.0]; val it - [6.33,8.67,8.0,9.0,11.67]real list http://sml-family.org/Basis/top-level-chapter.html http://sml-family.org/Basis/list.html http://sml-family.org/Basis/list-pair.html For some functions, polymorphic equality comparison is needed. I'm now explicitly showing this in the type of the function 1. (i) Code in SML a function segs3 'a list - ('a list) list that returns the list of all length-3 segments (sequences of 3 consecutive elements) of the given list. (A list of length 2 or less has no such segments.) ,7,9,10,5,12,18]; - segs3 [3, val it -[[3,7,9],[7,9,10], [9,10,5], [10,5,12], [5,12,18]] : (int list) list (ii) Code a function avgs3 real list -real list that returns the average of all length-3 segments of the given list of reals. (Use segs3.) - avgs3 [3.0,7.0,9.0,10.0,5.0,12.0,18.0]; val it - [6.33,8.67,8.0,9.0,11.67]real list
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
