Question: PLEASE WRITE IN SML pSumtoN -20% 6. grou groupSumtoN function takes two arguments where the first argument is an integer (N) and the second is
PLEASE WRITE IN SML

pSumtoN -20% 6. grou groupSumtoN function takes two arguments where the first argument is an integer (N) and the second is a list (L). The goal is to produce a result in which the elements of the original list have been collected into ordered sub-lists each containing maximum number of consecutive elements from L summing up to N or less (where N is the integer argument). The leftover elements (if there is any) are included as the last sub-list with a sum less than N. If an element in the input list L is greater than N that element should be included in its own sublist (including that element only) The type of groupSumtoN should be: int -> int 1list -> int list list Note: this function is not required to be tail-recursive Examples: groupSumtoN 15 [1, 2, 3, 4, 5, 6, 7, 8, 9, 10] [[1,2,3,4,51,16,71, 181,191,[10]] >groupSumtoN 11 [1, 2, 3, 4, 5, 6, 7, 8, 9, 10] [[1,2,3,41,15,61,171,181,191,110]] pSumtoN -20% 6. grou groupSumtoN function takes two arguments where the first argument is an integer (N) and the second is a list (L). The goal is to produce a result in which the elements of the original list have been collected into ordered sub-lists each containing maximum number of consecutive elements from L summing up to N or less (where N is the integer argument). The leftover elements (if there is any) are included as the last sub-list with a sum less than N. If an element in the input list L is greater than N that element should be included in its own sublist (including that element only) The type of groupSumtoN should be: int -> int 1list -> int list list Note: this function is not required to be tail-recursive Examples: groupSumtoN 15 [1, 2, 3, 4, 5, 6, 7, 8, 9, 10] [[1,2,3,4,51,16,71, 181,191,[10]] >groupSumtoN 11 [1, 2, 3, 4, 5, 6, 7, 8, 9, 10] [[1,2,3,41,15,61,171,181,191,110]]
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
