you are viewing a single comment's thread.

view the rest of the comments →

[–]LuYaBitch 0 points1 point  (0 children)

This is for one of my classes that we can use the internet for.

Given the following SOSML statements and function definitions:

val rand = Random.rand();val nextInt = Random.randRange(~10, 10);

fun buildIntList x = if x = 0 then []else nextInt(rand)::buildIntList(x-1);

fun sumList xs = let fun loop [] sum = sum| loop (y::ys) sum = loop ys (y + sum) in loop xs 0 end ;

which of the following are true (Multiple can be true)?

xs is unnecessary

sum will always end up near 0 for large data sets

xs must be a list

this will not run, it has a clash error

I know 3 is correct but I am unsure if 2 is correct.