I have these functions:
fun IsDivisible(t, t2) = if t mod t2 > 0 then true else false;
fun IsDivisibleFilter(ts, t) = List.filter(fn x => IsDivisible(x, t)) ts;
fun IsDivisibleMap(ts, ts2) = map(fn x => IsDivisibleFilter(ts, x)) ts2;
IsDivisibleMap - Takes two lists of ints, ts, and ts2, and returns a list containing those elements of ts that are indivisible by any elements in ts2.
E.g. IsDivisibleMap([10,11,12,13,14],[3,5,7]) should return [11,13].
The way I have it now it is returning a list of lists, where each list is the result for each number in ts2
E.g. IsDivisibleMap([10,11,12,13,14],[3,5,7]) is returning [10,11,13,14][11,12,13,14][10,11,12,13]
How can I return the result that I am looking for while still using map and filter wherever possible?