1 Answer
1

The error message is clear; since a has type int and [] has type 'a list, their types are mismatched.

The problem is you chose the wrong high-order function for the task. The filter on List structure is best suited here:

fun less (e, L) = filter (fn a => a < e) L

You could use recursion to implement less explicitly, or use foldl/foldr to accumulate filtered lists. However, map seems irrelevant here.

EDIT:

I will give a hint about using foldl/foldr. You start with empty list as the accumulator. Prepend an element to the accumulator whenever that element is smaller than e; otherwise, return the accumulator.